mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Added setting to store last mention report email date (#16399)
Because there is no guarantee about a daily job running exactly once a day, we need to store the last time that the email was sent, so that we can refrain from sending one if it's been less than a day since the last. A setting has been used for this as we don't currently have a pattern for it, we might want to consider moving this to some kind of cache based solution in future. This has been added as a core setting so that we don't expose it via the API. The setting is stored as a number to allow us to store value as unix timestamp. --------- Co-authored-by: Rishabh <zrishabhgarg@gmail.com>
This commit is contained in:
parent
64e5fbe5b7
commit
bdaddd1a64
7 changed files with 20 additions and 3 deletions
|
@ -0,0 +1,8 @@
|
|||
const {addSetting} = require('../../utils');
|
||||
|
||||
module.exports = addSetting({
|
||||
key: 'last_mentions_report_email_timestamp',
|
||||
value: null,
|
||||
type: 'number',
|
||||
group: 'core'
|
||||
});
|
|
@ -1,5 +1,9 @@
|
|||
{
|
||||
"core": {
|
||||
"last_mentions_report_email_timestamp": {
|
||||
"defaultValue": null,
|
||||
"type": "number"
|
||||
},
|
||||
"db_hash": {
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
|
|
|
@ -15,6 +15,7 @@ describe('Settings', function () {
|
|||
|
||||
// Allowlist: Only this list needs updating when a core setting is added/removed/renamed
|
||||
const coreSettingKeys = [
|
||||
'last_mentions_report_email_timestamp',
|
||||
'db_hash',
|
||||
'routes_hash',
|
||||
'next_update_check',
|
||||
|
|
|
@ -5,7 +5,7 @@ const db = require('../../../core/server/data/db');
|
|||
// Stuff we are testing
|
||||
const models = require('../../../core/server/models');
|
||||
|
||||
const SETTINGS_LENGTH = 81;
|
||||
const SETTINGS_LENGTH = 82;
|
||||
|
||||
describe('Settings Model', function () {
|
||||
before(models.init);
|
||||
|
|
|
@ -236,7 +236,7 @@ describe('Exporter', function () {
|
|||
|
||||
// NOTE: if default settings changed either modify the settings keys blocklist or increase allowedKeysLength
|
||||
// This is a reminder to think about the importer/exporter scenarios ;)
|
||||
const allowedKeysLength = 73;
|
||||
const allowedKeysLength = 74;
|
||||
totalKeysLength.should.eql(SETTING_KEYS_BLOCKLIST.length + allowedKeysLength);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('DB version integrity', function () {
|
|||
// Only these variables should need updating
|
||||
const currentSchemaHash = '08a9d998774843eb5594450280ab0fce';
|
||||
const currentFixturesHash = 'd99d3c2891e79b8662ed6a312490d2fd';
|
||||
const currentSettingsHash = 'b0c8359b7482e39112e7c5739d43f11b';
|
||||
const currentSettingsHash = '7b567742b9667d38191d8455c422c5d5';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{
|
||||
"core": {
|
||||
"last_mentions_report_email_timestamp": {
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
},
|
||||
"db_hash": {
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
|
|
Loading…
Add table
Reference in a new issue