🎨 settings inconsistency (#8381)

no issue
- replace camelCase settings keys with underscore_case for consistency
- discussed here https://github.com/TryGhost/Ghost-Admin/pull/661#discussion_r112939982
This commit is contained in:
Katharina Irrgang 2017-04-24 19:41:00 +02:00 committed by Kevin Ansfield
parent 68d9b30438
commit 4e2474a018
31 changed files with 101 additions and 101 deletions

View File

@ -158,7 +158,7 @@ authentication = {
var options = {context: {internal: true}},
dbHash, token;
return settings.read(_.merge({key: 'dbHash'}, options))
return settings.read(_.merge({key: 'db_hash'}, options))
.then(function fetchedSettings(response) {
dbHash = response.settings[0].value;
@ -286,7 +286,7 @@ authentication = {
oldPassword = data.oldPassword,
newPassword = data.newPassword;
return settings.read(_.merge({key: 'dbHash'}, options))
return settings.read(_.merge({key: 'db_hash'}, options))
.then(function fetchedSettings(response) {
dbHash = response.settings[0].value;

View File

@ -129,16 +129,16 @@ notifications = {
var tasks;
/**
* Adds the id of notification to "seenNotifications" array.
* Adds the id of notification to "seen_notifications" array.
* @param {Object} notification
* @return {*|Promise}
*/
function markAsSeen(notification) {
var context = {internal: true};
return settings.read({key: 'seenNotifications', context: context}).then(function then(response) {
return settings.read({key: 'seen_notifications', context: context}).then(function then(response) {
var seenNotifications = JSON.parse(response.settings[0].value);
seenNotifications = _.uniqBy(seenNotifications.concat([notification.id]));
return settings.edit({settings: [{key: 'seenNotifications', value: seenNotifications}]}, {context: context});
return settings.edit({settings: [{key: 'seen_notifications', value: seenNotifications}]}, {context: context});
});
}

View File

@ -43,7 +43,7 @@ settingsFilter = function (settings, filter) {
*
* Takes a keyed JSON object
* E.g.
* dbHash: {
* db_hash: {
* id: '123abc',
* key: 'dbash',
* value: 'xxxx',
@ -103,7 +103,7 @@ canEditAllSettings = function (settingsInfo, options) {
));
}
if (setting.key === 'activeTheme') {
if (setting.key === 'active_theme') {
return Promise.reject(
new errors.BadRequestError({
message: i18n.t('errors.api.settings.activeThemeSetViaAPI.error'),

View File

@ -34,7 +34,7 @@ themes = {
activate: function activate(options) {
var themeName = options.name,
newSettings = [{
key: 'activeTheme',
key: 'active_theme',
value: themeName
}],
loadedTheme,
@ -50,7 +50,7 @@ themes = {
if (!loadedTheme) {
return Promise.reject(new errors.ValidationError({
message: i18n.t('notices.data.validation.index.themeCannotBeActivated', {themeName: themeName}),
context: 'activeTheme'
context: 'active_theme'
}));
}
@ -127,7 +127,7 @@ themes = {
.then(function activateAndReturn(loadedTheme) {
// If this is the active theme, we are overriding
// This is a special case of activation
if (zip.shortName === settingsCache.get('activeTheme')) {
if (zip.shortName === settingsCache.get('active_theme')) {
// Activate! (sort of)
debug('Activating theme (method C, on API "override")', zip.shortName);
themeUtils.activate(loadedTheme, checkedTheme);
@ -193,7 +193,7 @@ themes = {
throw new errors.ValidationError({message: i18n.t('errors.api.themes.destroyCasper')});
}
if (themeName === settingsCache.get('activeTheme')) {
if (themeName === settingsCache.get('active_theme')) {
throw new errors.ValidationError({message: i18n.t('errors.api.themes.destroyActive')});
}

View File

@ -11,7 +11,7 @@ var _ = require('lodash'),
availableApps = {};
function getInstalledApps() {
return api.settings.read({context: {internal: true}, key: 'installedApps'}).then(function (response) {
return api.settings.read({context: {internal: true}, key: 'installed_apps'}).then(function (response) {
var installed = response.settings[0];
installed.value = installed.value || '[]';
@ -30,7 +30,7 @@ function saveInstalledApps(installedApps) {
return getInstalledApps().then(function (currentInstalledApps) {
var updatedAppsInstalled = _.difference(_.uniq(installedApps.concat(currentInstalledApps)), config.get('internalApps'));
return api.settings.edit({settings: [{key: 'installedApps', value: updatedAppsInstalled}]}, {context: {internal: true}});
return api.settings.edit({settings: [{key: 'installed_apps', value: updatedAppsInstalled}]}, {context: {internal: true}});
});
}
@ -40,7 +40,7 @@ module.exports = {
try {
// We have to parse the value because it's a string
api.settings.read({context: {internal: true}, key: 'activeApps'}).then(function (response) {
api.settings.read({context: {internal: true}, key: 'active_apps'}).then(function (response) {
var aApps = response.settings[0];
appsToLoad = JSON.parse(aApps.value) || [];

View File

@ -28,7 +28,7 @@ function verifySessionHash(salt, hash) {
privateBlogging = {
checkIsPrivate: function checkIsPrivate(req, res, next) {
return api.settings.read({context: {internal: true}, key: 'isPrivate'}).then(function then(response) {
return api.settings.read({context: {internal: true}, key: 'is_private'}).then(function then(response) {
var pass = response.settings[0];
if (_.isEmpty(pass.value) || pass.value === 'false') {

View File

@ -37,9 +37,9 @@ describe('Private Blogging', function () {
});
it('checkIsPrivate should call next if not private', function (done) {
apiSettingsStub.withArgs(sinon.match.has('key', 'isPrivate')).returns(Promise.resolve({
apiSettingsStub.withArgs(sinon.match.has('key', 'is_private')).returns(Promise.resolve({
settings: [{
key: 'isPrivate',
key: 'is_private',
value: 'false'
}]
}));
@ -53,9 +53,9 @@ describe('Private Blogging', function () {
});
it('checkIsPrivate should load session if private', function (done) {
apiSettingsStub.withArgs(sinon.match.has('key', 'isPrivate')).returns(Promise.resolve({
apiSettingsStub.withArgs(sinon.match.has('key', 'is_private')).returns(Promise.resolve({
settings: [{
key: 'isPrivate',
key: 'is_private',
value: 'true'
}]
}));

View File

@ -12,8 +12,8 @@ var Promise = require('bluebird'),
stripProperties;
updatedSettingKeys = {
activePlugins: 'activeApps',
installedPlugins: 'installedApps'
activePlugins: 'active_apps',
installedPlugins: 'installed_apps'
};
areEmpty = function (object) {

View File

@ -54,7 +54,7 @@ function getMetaData(data, root) {
url: utils.url.urlFor('home', true),
facebook: settingsCache.get('facebook'),
twitter: settingsCache.get('twitter'),
timezone: settingsCache.get('activeTimezone'),
timezone: settingsCache.get('active_timezone'),
navigation: settingsCache.get('navigation'),
icon: settingsCache.get('icon'),
cover_image: settingsCache.get('cover_image'),

View File

@ -1,15 +1,15 @@
{
"core": {
"dbHash": {
"db_hash": {
"defaultValue": null
},
"nextUpdateCheck": {
"next_update_check": {
"defaultValue": null
},
"displayUpdateNotification": {
"display_update_notification": {
"defaultValue": null
},
"seenNotifications": {
"seen_notifications": {
"defaultValue": "[]"
}
},
@ -29,20 +29,20 @@
"icon": {
"defaultValue": ""
},
"defaultLang": {
"default_lang": {
"defaultValue": "en_US",
"validations": {
"isEmpty": false
}
},
"activeTimezone": {
"active_timezone": {
"defaultValue": "Etc/UTC",
"validations": {
"isTimezone": true,
"isEmpty": false
}
},
"forceI18n": {
"force_i18n": {
"defaultValue": "true",
"validations": {
"isEmpty": false,
@ -83,20 +83,20 @@
}
},
"theme": {
"activeTheme": {
"active_theme": {
"defaultValue": "casper"
}
},
"app": {
"activeApps": {
"active_apps": {
"defaultValue": "[]"
},
"installedApps": {
"installed_apps": {
"defaultValue": "[]"
}
},
"private": {
"isPrivate": {
"is_private": {
"defaultValue": "false"
},
"password": {

View File

@ -6,7 +6,7 @@ var supportedLocales = ['en'],
chalk = require('chalk'),
MessageFormat = require('intl-messageformat'),
// TODO: fetch this dynamically based on overall blog settings (`key = "defaultLang"` in the `settings` table
// TODO: fetch this dynamically based on overall blog settings (`key = "default_lang"`) in the `settings` table
currentLocale = 'en',
blos,
I18n;

View File

@ -41,7 +41,7 @@ events.on('user.deactivated', function (userModel) {
* - reschedule all scheduled posts
* - draft scheduled posts, when the published_at would be in the past
*/
events.on('settings.activeTimezone.edited', function (settingModel) {
events.on('settings.active_timezone.edited', function (settingModel) {
var newTimezone = settingModel.attributes.value,
previousTimezone = settingModel._updatedAttributes.value,
timezoneOffsetDiff = moment.tz(previousTimezone).utcOffset() - moment.tz(newTimezone).utcOffset(),

View File

@ -19,7 +19,7 @@ function parseDefaultSettings() {
var defaultSettingsInCategories = require('../data/schema/').defaultSettings,
defaultSettingsFlattened = {},
dynamicDefault = {
dbHash: uuid.v4()
db_hash: uuid.v4()
};
_.each(defaultSettingsInCategories, function each(settings, categoryName) {

View File

@ -20,12 +20,12 @@ var debug = require('debug')('ghost:settings:cache'),
*
* {
* type: core
* key: dbHash
* key: db_hash
* value: ...
* }
*
* But the settings cache does not allow requesting a value by type, only by key.
* e.g. settingsCache.get('dbHash')
* e.g. settingsCache.get('db_hash')
*/
module.exports = {
/**

View File

@ -17,7 +17,7 @@ module.exports = {
// Init themes module
// TODO: move this once we're clear what needs to happen here
init: function initThemes() {
var activeThemeName = settingsCache.get('activeTheme'),
var activeThemeName = settingsCache.get('active_theme'),
self = this;
debug('init themes', activeThemeName);

View File

@ -18,7 +18,7 @@ themeMiddleware.ensureActiveTheme = function ensureActiveTheme(req, res, next) {
return next(new errors.InternalServerError({
// We use the settingsCache here, because the setting will be set,
// even if the theme itself is not usable because it is invalid or missing.
message: i18n.t('errors.middleware.themehandler.missingTheme', {theme: settingsCache.get('activeTheme')})
message: i18n.t('errors.middleware.themehandler.missingTheme', {theme: settingsCache.get('active_theme')})
}));
}
@ -40,7 +40,7 @@ themeMiddleware.updateTemplateData = function updateTemplateData(req, res, next)
description: settingsCache.get('description'),
facebook: settingsCache.get('facebook'),
twitter: settingsCache.get('twitter'),
timezone: settingsCache.get('activeTimezone'),
timezone: settingsCache.get('active_timezone'),
navigation: settingsCache.get('navigation'),
permalinks: settingsCache.get('permalinks'),
icon: settingsCache.get('icon'),

View File

@ -16,13 +16,13 @@ module.exports = function toJSON(name, checkedTheme) {
if (!name) {
toFilter = themeList.getAll();
// Default to returning the full list
themeResult = packages.filterPackages(toFilter, settingsCache.get('activeTheme'));
themeResult = packages.filterPackages(toFilter, settingsCache.get('active_theme'));
} else {
// If we pass in a gscan result, convert this instead
toFilter = {};
toFilter[name] = themeList.get(name);
themeResult = packages.filterPackages(toFilter, settingsCache.get('activeTheme'));
themeResult = packages.filterPackages(toFilter, settingsCache.get('active_theme'));
if (checkedTheme && checkedTheme.results.warning.length > 0) {
themeResult[0].warnings = _.cloneDeep(checkedTheme.results.warning);

View File

@ -34,9 +34,9 @@
"errors": {
"apps": {
"failedToParseActiveAppsSettings": {
"error": "Failed to parse activeApps setting value: {message}",
"error": "Failed to parse active_apps setting value: {message}",
"context": "Your apps will not be loaded.",
"help": "Check your settings table for typos in the activeApps value. It should look like: [\"app-1\", \"app2\"] (double quotes required)."
"help": "Check your settings table for typos in the active_apps value. It should look like: [\"app-1\", \"app2\"] (double quotes required)."
},
"appWillNotBeLoaded": {
"error": "The app will not be loaded",
@ -335,7 +335,7 @@
"problemFindingSetting": "Problem finding setting: {key}",
"accessCoreSettingFromExtReq": "Attempted to access core setting from external request",
"activeThemeSetViaAPI": {
"error": "Attempted to change activeTheme via settings API",
"error": "Attempted to change active_theme via settings API",
"help": "Please activate theme via the themes API endpoints instead"
},
"invalidJsonInLabs": "Error: Invalid JSON in settings.labs",

View File

@ -7,7 +7,7 @@
//
// The data collected is as follows:
//
// - blog id - a hash of the blog hostname, pathname and dbHash. No identifiable info is stored.
// - blog id - a hash of the blog hostname, pathname and db_hash. No identifiable info is stored.
// - ghost version
// - node version
// - npm version
@ -42,7 +42,7 @@ function updateCheckError(err) {
err = errors.utils.deserialize(err);
api.settings.edit(
{settings: [{key: 'nextUpdateCheck', value: Math.round(Date.now() / 1000 + 24 * 3600)}]},
{settings: [{key: 'next_update_check', value: Math.round(Date.now() / 1000 + 24 * 3600)}]},
internal
);
@ -70,7 +70,7 @@ function createCustomNotification(message) {
message: message.content
},
getAllNotifications = api.notifications.browse({context: {internal: true}}),
getSeenNotifications = api.settings.read(_.extend({key: 'seenNotifications'}, internal));
getSeenNotifications = api.settings.read(_.extend({key: 'seen_notifications'}, internal));
return Promise.join(getAllNotifications, getSeenNotifications, function joined(all, seen) {
var isSeen = _.includes(JSON.parse(seen.settings[0].value || []), notification.id),
@ -96,9 +96,9 @@ function updateCheckData() {
mailConfig.transport);
return Promise.props({
hash: api.settings.read(_.extend({key: 'dbHash'}, internal)).reflect(),
theme: api.settings.read(_.extend({key: 'activeTheme'}, internal)).reflect(),
apps: api.settings.read(_.extend({key: 'activeApps'}, internal))
hash: api.settings.read(_.extend({key: 'db_hash'}, internal)).reflect(),
theme: api.settings.read(_.extend({key: 'active_theme'}, internal)).reflect(),
apps: api.settings.read(_.extend({key: 'active_apps'}, internal))
.then(function (response) {
var apps = response.settings[0];
@ -204,14 +204,14 @@ function updateCheckRequest() {
*/
function updateCheckResponse(response) {
return Promise.all([
api.settings.edit({settings: [{key: 'nextUpdateCheck', value: response.next_check}]}, internal),
api.settings.edit({settings: [{key: 'displayUpdateNotification', value: response.version}]}, internal)
api.settings.edit({settings: [{key: 'next_update_check', value: response.next_check}]}, internal),
api.settings.edit({settings: [{key: 'display_update_notification', value: response.version}]}, internal)
]).then(function () {
var messages = response.messages || [];
/**
* by default the update check service returns messages: []
* but the latest release version get's stored anyway, because we adding the `displayUpdateNotification` ^
* but the latest release version get's stored anyway, because we adding the `display_update_notification` ^
*/
return Promise.map(messages, createCustomNotification);
});
@ -221,7 +221,7 @@ function updateCheck() {
if (config.isPrivacyDisabled('useUpdateCheck')) {
return Promise.resolve();
} else {
return api.settings.read(_.extend({key: 'nextUpdateCheck'}, internal)).then(function then(result) {
return api.settings.read(_.extend({key: 'next_update_check'}, internal)).then(function then(result) {
var nextUpdateCheck = result.settings[0];
if (nextUpdateCheck && nextUpdateCheck.value && nextUpdateCheck.value > moment().unix()) {
@ -238,7 +238,7 @@ function updateCheck() {
}
function showUpdateNotification() {
return api.settings.read(_.extend({key: 'displayUpdateNotification'}, internal)).then(function then(response) {
return api.settings.read(_.extend({key: 'display_update_notification'}, internal)).then(function then(response) {
var display = response.settings[0];
if (display && display.value && currentVersion && semver.gt(display.value, currentVersion)) {

View File

@ -174,7 +174,7 @@ function createUrl(urlPath, absolute, secure) {
function urlPathForPost(post) {
var output = '',
permalinks = settingsCache.get('permalinks'),
publishedAtMoment = moment.tz(post.published_at || Date.now(), settingsCache.get('activeTimezone')),
publishedAtMoment = moment.tz(post.published_at || Date.now(), settingsCache.get('active_timezone')),
tags = {
year: function () { return publishedAtMoment.format('YYYY'); },
month: function () { return publishedAtMoment.format('MM'); },

View File

@ -216,7 +216,7 @@ describe('Authentication API', function () {
it('reset password', function (done) {
models.Settings
.findOne({key: 'dbHash'})
.findOne({key: 'db_hash'})
.then(function (response) {
var token = utils.tokens.resetToken.generateHash({
expires: Date.now() + (1000 * 60),

View File

@ -152,7 +152,7 @@ describe('Notifications API', function () {
});
});
it('can destroy a custom notification and add its uuid to seenNotifications (owner)', function (done) {
it('can destroy a custom notification and add its uuid to seen_notifications (owner)', function (done) {
var customNotification = {
status: 'alert',
type: 'info',
@ -168,7 +168,7 @@ describe('Notifications API', function () {
NotificationsAPI.destroy(
_.extend({}, testUtils.context.internal, {id: notification.id})
).then(function () {
return SettingsAPI.read(_.extend({key: 'seenNotifications'}, testUtils.context.internal));
return SettingsAPI.read(_.extend({key: 'seen_notifications'}, testUtils.context.internal));
}).then(function (response) {
should.exist(response);
response.settings[0].value.should.containEql(notification.id);

View File

@ -95,8 +95,8 @@ describe('Settings API', function () {
});
it('cannot read core settings if not an internal request', function () {
return callApiWithContext(defaultContext, 'read', {key: 'dbHash'}).then(function () {
throw new Error('Allowed to read dbHash with external request');
return callApiWithContext(defaultContext, 'read', {key: 'db_hash'}).then(function () {
throw new Error('Allowed to read db_hash with external request');
}).catch(function (error) {
should.exist(error);
error.errorType.should.eql('NoPermissionError');
@ -104,7 +104,7 @@ describe('Settings API', function () {
});
it('can read core settings if an internal request', function () {
return callApiWithContext(internalContext, 'read', {key: 'dbHash'}).then(function (response) {
return callApiWithContext(internalContext, 'read', {key: 'db_hash'}).then(function (response) {
should.exist(response);
testUtils.API.checkResponse(response, 'settings');
response.settings.length.should.equal(1);
@ -137,7 +137,7 @@ describe('Settings API', function () {
});
it('cannot edit a core setting if not an internal request', function () {
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'dbHash', value: 'hash'}]}, {})
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'db_hash', value: 'hash'}]}, {})
.then(function () {
throw new Error('Allowed to edit a core setting as external request');
}).catch(function (err) {
@ -148,7 +148,7 @@ describe('Settings API', function () {
});
it('can edit a core setting with an internal request', function () {
return callApiWithContext(internalContext, 'edit', {settings: [{key: 'dbHash', value: 'hash'}]}, {})
return callApiWithContext(internalContext, 'edit', {settings: [{key: 'db_hash', value: 'hash'}]}, {})
.then(function (response) {
should.exist(response);
testUtils.API.checkResponse(response, 'settings');
@ -158,15 +158,15 @@ describe('Settings API', function () {
});
it('cannot edit the active theme setting via API even with internal context', function () {
return callApiWithContext(internalContext, 'edit', 'activeTheme', {
settings: [{key: 'activeTheme', value: 'rasper'}]
return callApiWithContext(internalContext, 'edit', 'active_theme', {
settings: [{key: 'active_theme', value: 'rasper'}]
}).then(function () {
throw new Error('Allowed to change active theme settting');
}).catch(function (err) {
should.exist(err);
err.errorType.should.eql('BadRequestError');
err.message.should.eql('Attempted to change activeTheme via settings API');
err.message.should.eql('Attempted to change active_theme via settings API');
});
});
@ -180,10 +180,10 @@ describe('Settings API', function () {
});
});
it('set activeTimezone: unknown timezone', function () {
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'activeTimezone', value: 'MFG'}]}, {})
it('set active_timezone: unknown timezone', function () {
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'active_timezone', value: 'MFG'}]}, {})
.then(function () {
throw new Error('We expect that the activeTimezone cannot be stored');
throw new Error('We expect that the active_timezone cannot be stored');
}).catch(function (errors) {
should.exist(errors);
errors.length.should.eql(1);
@ -191,7 +191,7 @@ describe('Settings API', function () {
});
});
it('set activeTimezone: known timezone', function () {
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'activeTimezone', value: 'Etc/UTC'}]}, {});
it('set active_timezone: known timezone', function () {
return callApiWithContext(defaultContext, 'edit', {settings: [{key: 'active_timezone', value: 'Etc/UTC'}]}, {});
});
});

View File

@ -201,8 +201,8 @@ describe('Import', function () {
// import no longer requires all data to be dropped, and adds posts
posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts');
// activeTheme should NOT have been overridden
_.find(settings, {key: 'activeTheme'}).value.should.equal('casper', 'Wrong theme');
// active_theme should NOT have been overridden
_.find(settings, {key: 'active_theme'}).value.should.equal('casper', 'Wrong theme');
// test tags
tags.length.should.equal(exportData.data.tags.length, 'no new tags');
@ -308,8 +308,8 @@ describe('Import', function () {
// import no longer requires all data to be dropped, and adds posts
posts.length.should.equal(exportData.data.posts.length, 'Wrong number of posts');
// activeTheme should NOT have been overridden
_.find(settings, {key: 'activeTheme'}).value.should.equal('casper', 'Wrong theme');
// active_theme should NOT have been overridden
_.find(settings, {key: 'active_theme'}).value.should.equal('casper', 'Wrong theme');
// test tags
tags.length.should.equal(exportData.data.tags.length, 'no new tags');

View File

@ -78,7 +78,7 @@ describe('Models: listeners', function () {
});
});
it('activeTimezone changes from London to Los Angeles', function (done) {
it('active_timezone changes from London to Los Angeles', function (done) {
var timeout;
/**
@ -102,7 +102,7 @@ describe('Models: listeners', function () {
scope.newTimezone = 'America/Los_Angeles';
scope.oldTimezone = 'Europe/London';
eventsToRemember['settings.activeTimezone.edited']({
eventsToRemember['settings.active_timezone.edited']({
attributes: {value: scope.newTimezone},
_updatedAttributes: {value: scope.oldTimezone}
});
@ -137,7 +137,7 @@ describe('Models: listeners', function () {
})();
});
it('activeTimezone changes from Baghdad to UTC', function (done) {
it('active_timezone changes from Baghdad to UTC', function (done) {
var timeout;
/**
@ -159,7 +159,7 @@ describe('Models: listeners', function () {
scope.oldTimezone = 'Asia/Baghdad';
scope.newTimezone = 'Etc/UTC';
eventsToRemember['settings.activeTimezone.edited']({
eventsToRemember['settings.active_timezone.edited']({
attributes: {value: scope.newTimezone},
_updatedAttributes: {value: scope.oldTimezone}
});
@ -194,7 +194,7 @@ describe('Models: listeners', function () {
})();
});
it('activeTimezone changes from Amsterdam to Seoul', function (done) {
it('active_timezone changes from Amsterdam to Seoul', function (done) {
var timeout;
/**
@ -216,7 +216,7 @@ describe('Models: listeners', function () {
scope.oldTimezone = 'Europe/Amsterdam';
scope.newTimezone = 'Asia/Seoul';
eventsToRemember['settings.activeTimezone.edited']({
eventsToRemember['settings.active_timezone.edited']({
attributes: {value: scope.newTimezone},
_updatedAttributes: {value: scope.oldTimezone}
});
@ -281,7 +281,7 @@ describe('Models: listeners', function () {
scope.oldTimezone = 'Asia/Baghdad';
scope.newTimezone = 'Etc/UTC';
eventsToRemember['settings.activeTimezone.edited']({
eventsToRemember['settings.active_timezone.edited']({
attributes: {value: scope.newTimezone},
_updatedAttributes: {value: scope.oldTimezone}
});
@ -316,7 +316,7 @@ describe('Models: listeners', function () {
describe('db has no scheduled posts', function () {
it('no scheduled posts', function (done) {
eventsToRemember['settings.activeTimezone.edited']({
eventsToRemember['settings.active_timezone.edited']({
attributes: {value: scope.newTimezone},
_updatedAttributes: {value: scope.oldTimezone}
});

View File

@ -18,7 +18,7 @@ describe('Frontend Controller', function () {
function resetLocalSettingsCache() {
localSettingsCache = {
permalinks: '/:slug/',
activeTheme: 'casper'
active_theme: 'casper'
};
}

View File

@ -70,14 +70,14 @@ describe('templates', function () {
});
});
it('returns fallback if there is no activeTheme', function () {
it('returns fallback if there is no active_theme', function () {
getActiveThemeStub.returns(undefined);
templates.pickTemplate(['tag-test', 'tag', 'index'], 'fallback').should.eql('fallback');
templates.pickTemplate(['page-my-post', 'page', 'post'], 'fallback').should.eql('fallback');
});
it('returns fallback if activeTheme has no templates', function () {
it('returns fallback if active_theme has no templates', function () {
templates.pickTemplate(['tag-test', 'tag', 'index'], 'fallback').should.eql('fallback');
templates.pickTemplate(['page-about', 'page', 'post'], 'fallback').should.eql('fallback');
});
@ -232,7 +232,7 @@ describe('templates', function () {
});
});
it('will fall back to default if there is no activeTheme', function () {
it('will fall back to default if there is no active_theme', function () {
getActiveThemeStub.returns(undefined);
templates.error(500).should.match(/core\/server\/views\/error.hbs$/);

View File

@ -163,14 +163,14 @@ describe('Middleware: uncapitalise', function () {
it('does not convert any capitals after the endpoint', function (done) {
var query = '?filter=mAgic';
req.path = '/Ghost/API/v0.1/settings/isPrivate/';
req.path = '/Ghost/API/v0.1/settings/is_private/';
req.url = req.path + query;
uncapitalise(req, res, next);
next.called.should.be.false();
res.redirect.calledOnce.should.be.true();
res.redirect.calledWith(301, '/ghost/api/v0.1/settings/isPrivate/?filter=mAgic').should.be.true();
res.redirect.calledWith(301, '/ghost/api/v0.1/settings/is_private/?filter=mAgic').should.be.true();
done();
});

View File

@ -24,7 +24,7 @@ describe('{{body_class}} helper', function () {
data: {
root: {
context: [],
settings: {activeTheme: 'casper'}
settings: {active_theme: 'casper'}
}
}
};

View File

@ -36,7 +36,7 @@ describe('Themes', function () {
beforeEach(function () {
mountThemeSpy = sandbox.spy();
settingsCacheStub.withArgs('activeTheme').returns('casper');
settingsCacheStub.withArgs('active_theme').returns('casper');
});
it('mounts active theme if not yet mounted', function (done) {
@ -84,7 +84,7 @@ describe('Themes', function () {
should.exist(err);
err.message.should.eql('The currently active theme "casper" is missing.');
settingsCacheStub.calledWith('activeTheme').should.be.true();
settingsCacheStub.calledWith('active_theme').should.be.true();
getActiveThemeStub.called.should.be.true();
mountThemeSpy.called.should.be.false();

View File

@ -451,7 +451,7 @@ describe('Url', function () {
});
it('permalink is /:year/:month/:day/:slug, blog timezone is Los Angeles', function () {
localSettingsCache.activeTimezone = 'America/Los_Angeles';
localSettingsCache.active_timezone = 'America/Los_Angeles';
localSettingsCache.permalinks = '/:year/:month/:day/:slug/';
var testData = testUtils.DataGenerator.Content.posts[2],
@ -462,7 +462,7 @@ describe('Url', function () {
});
it('permalink is /:year/:month/:day/:slug, blog timezone is Asia Tokyo', function () {
localSettingsCache.activeTimezone = 'Asia/Tokyo';
localSettingsCache.active_timezone = 'Asia/Tokyo';
localSettingsCache.permalinks = '/:year/:month/:day/:slug/';
var testData = testUtils.DataGenerator.Content.posts[2],
@ -473,7 +473,7 @@ describe('Url', function () {
});
it('post is page, no permalink usage allowed at all', function () {
localSettingsCache.activeTimezone = 'America/Los_Angeles';
localSettingsCache.active_timezone = 'America/Los_Angeles';
localSettingsCache.permalinks = '/:year/:month/:day/:slug/';
var testData = testUtils.DataGenerator.Content.posts[5],
@ -483,7 +483,7 @@ describe('Url', function () {
});
it('permalink is /:year/:id:/:author', function () {
localSettingsCache.activeTimezone = 'America/Los_Angeles';
localSettingsCache.active_timezone = 'America/Los_Angeles';
localSettingsCache.permalinks = '/:year/:id/:author/';
var testData = _.merge(testUtils.DataGenerator.Content.posts[2], {id: 3}, {author: {slug: 'joe-blog'}}),
@ -494,7 +494,7 @@ describe('Url', function () {
});
it('permalink is /:year/:id:/:author', function () {
localSettingsCache.activeTimezone = 'Europe/Berlin';
localSettingsCache.active_timezone = 'Europe/Berlin';
localSettingsCache.permalinks = '/:year/:id/:author/';
var testData = _.merge(testUtils.DataGenerator.Content.posts[2], {id: 3}, {author: {slug: 'joe-blog'}}),
@ -505,7 +505,7 @@ describe('Url', function () {
});
it('post is not published yet', function () {
localSettingsCache.activeTimezone = 'Europe/London';
localSettingsCache.active_timezone = 'Europe/London';
localSettingsCache.permalinks = '/:year/:month/:day/:slug/';
var testData = _.merge(testUtils.DataGenerator.Content.posts[2], {id: 3, published_at: null}),