0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

fix: refresh settings cache for migration 006 (#7147)

no issue
- refresh settings cache after 006/001 migration fixture
This commit is contained in:
Katharina Irrgang 2016-07-26 14:53:17 +02:00 committed by Kevin Ansfield
parent e76d35df7d
commit c6f1a8de13
3 changed files with 11 additions and 2 deletions

View file

@ -74,7 +74,8 @@ updateConfigCache = function () {
* @param {Object} settings
* @returns {Settings}
*/
updateSettingsCache = function (settings) {
updateSettingsCache = function (settings, options) {
options = options || {};
settings = settings || {};
if (!_.isEmpty(settings)) {
@ -87,7 +88,7 @@ updateSettingsCache = function (settings) {
return Promise.resolve(settingsCache);
}
return dataProvider.Settings.findAll()
return dataProvider.Settings.findAll(options)
.then(function (result) {
settingsCache = readSettingsResult(result.models);

View file

@ -1,5 +1,6 @@
var config = require('../../../../config'),
models = require(config.paths.corePath + '/server/models'),
api = require(config.paths.corePath + '/server/api'),
sequence = require(config.paths.corePath + '/server/utils/sequence'),
moment = require('moment'),
_ = require('lodash'),
@ -199,6 +200,9 @@ module.exports = function transformDatesIntoUTC(options, logger) {
key: 'migrations',
value: JSON.stringify(settingsMigrations)
}, options);
},
function updateSettingsCache() {
return api.settings.updateSettingsCache(null, options);
}]
).catch(function (err) {
if (err.message === 'skip') {

View file

@ -8,6 +8,7 @@ var should = require('should'),
// Stuff we are testing
configUtils = require('../utils/configUtils'),
models = require('../../server/models'),
api = require('../../server/api'),
notifications = require('../../server/api/notifications'),
versioning = require('../../server/data/schema/versioning'),
update = rewire('../../server/data/migration/fixtures/update'),
@ -1035,6 +1036,7 @@ describe('Fixtures', function () {
model.set('id', Date.now());
model.set('created_at', createdAt);
model.set('key', model.id.toString());
model.set('name', modelType);
newModels[model.id] = model;
return Promise.resolve({models: [model]});
@ -1048,6 +1050,8 @@ describe('Fixtures', function () {
sandbox.stub(models[modelType], 'edit').returns(Promise.resolve({}));
});
sandbox.stub(api.settings, 'updateSettingsCache').returns(Promise.resolve({}));
});
it('sqlite: no UTC update, only format', function (done) {