mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
Removed active_timezone, default_locale & locale compat (#14788)
- These settings no longer exist, having been renamed to timezone and lang - As of 5.0 we no longer need any kind of backwards compatibility outside of the importer - We making breaking changes and cleaning up as many old code paths as possible - We have not really exposed the admin Settings API, meaning backwards compatibility was more for internal use - We will be changing lang back to locale, but that's a separate issue and won't need backwards compatibility
This commit is contained in:
parent
ae45579903
commit
196b8ad0da
@ -70,20 +70,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
read(apiConfig, frame) {
|
|
||||||
if (frame.options.key === 'active_timezone') {
|
|
||||||
frame.options.key = 'timezone';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.options.key === 'default_locale') {
|
|
||||||
frame.options.key = 'lang';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.options.key === 'locale') {
|
|
||||||
frame.options.key = 'lang';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
edit(apiConfig, frame) {
|
edit(apiConfig, frame) {
|
||||||
// CASE: allow shorthand syntax where a single key and value are passed to edit instead of object and options
|
// CASE: allow shorthand syntax where a single key and value are passed to edit instead of object and options
|
||||||
if (_.isString(frame.data)) {
|
if (_.isString(frame.data)) {
|
||||||
@ -133,18 +119,6 @@ module.exports = {
|
|||||||
setting.value = setting.value === 'true';
|
setting.value = setting.value === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting.key === 'active_timezone') {
|
|
||||||
setting.key = 'timezone';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setting.key === 'default_locale') {
|
|
||||||
setting.key = 'lang';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setting.key === 'locale') {
|
|
||||||
setting.key = 'lang';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setting.key === 'labs') {
|
if (setting.key === 'labs') {
|
||||||
const inputLabsValue = JSON.parse(setting.value);
|
const inputLabsValue = JSON.parse(setting.value);
|
||||||
const filteredLabsValue = {};
|
const filteredLabsValue = {};
|
||||||
|
@ -40,24 +40,6 @@ module.exports.forSettings = (attrs, frame) => {
|
|||||||
if (_.isArray(attrs)) {
|
if (_.isArray(attrs)) {
|
||||||
// CASE: read single setting
|
// CASE: read single setting
|
||||||
if (frame.original.params && frame.original.params.key) {
|
if (frame.original.params && frame.original.params.key) {
|
||||||
if (frame.original.params.key === 'active_timezone') {
|
|
||||||
attrs[0].key = 'active_timezone';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.original.params.key === 'default_locale') {
|
|
||||||
attrs[0].key = 'default_locale';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.original.params.key === 'timezone') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.original.params.key === 'lang') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame.original.params.key === 'slack_url'
|
if (frame.original.params.key === 'slack_url'
|
||||||
|| frame.original.params.key === 'slack_username') {
|
|| frame.original.params.key === 'slack_username') {
|
||||||
return;
|
return;
|
||||||
@ -66,16 +48,7 @@ module.exports.forSettings = (attrs, frame) => {
|
|||||||
// CASE: edit
|
// CASE: edit
|
||||||
if (frame.original.body && frame.original.body.settings) {
|
if (frame.original.body && frame.original.body.settings) {
|
||||||
frame.original.body.settings.forEach((setting) => {
|
frame.original.body.settings.forEach((setting) => {
|
||||||
if (setting.key === 'active_timezone') {
|
if (setting.key === 'slack') {
|
||||||
const target = _.find(attrs, {key: 'timezone'});
|
|
||||||
target.key = 'active_timezone';
|
|
||||||
} else if (setting.key === 'default_locale') {
|
|
||||||
const target = _.find(attrs, {key: 'lang'});
|
|
||||||
target.key = 'default_locale';
|
|
||||||
} else if (setting.key === 'locale') {
|
|
||||||
const target = _.find(attrs, {key: 'lang'});
|
|
||||||
target.key = 'locale';
|
|
||||||
} else if (setting.key === 'slack') {
|
|
||||||
const slackURL = _.cloneDeep(_.find(attrs, {key: 'slack_url'}));
|
const slackURL = _.cloneDeep(_.find(attrs, {key: 'slack_url'}));
|
||||||
const slackUsername = _.cloneDeep(_.find(attrs, {key: 'slack_username'}));
|
const slackUsername = _.cloneDeep(_.find(attrs, {key: 'slack_username'}));
|
||||||
|
|
||||||
@ -96,21 +69,8 @@ module.exports.forSettings = (attrs, frame) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CASE: browse all settings, add extra keys and keep deprecated
|
// CASE: browse all settings, add extra keys and keep deprecated
|
||||||
const timezone = _.cloneDeep(_.find(attrs, {key: 'timezone'}));
|
|
||||||
const lang = _.cloneDeep(_.find(attrs, {key: 'lang'}));
|
|
||||||
const slackURL = _.cloneDeep(_.find(attrs, {key: 'slack_url'}));
|
const slackURL = _.cloneDeep(_.find(attrs, {key: 'slack_url'}));
|
||||||
const slackUsername = _.cloneDeep(_.find(attrs, {key: 'slack_username'}));
|
const slackUsername = _.cloneDeep(_.find(attrs, {key: 'slack_username'}));
|
||||||
const locale = _.cloneDeep(_.find(attrs, {key: 'lang'}));
|
|
||||||
|
|
||||||
if (timezone) {
|
|
||||||
timezone.key = 'active_timezone';
|
|
||||||
attrs.push(timezone);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lang) {
|
|
||||||
lang.key = 'default_locale';
|
|
||||||
attrs.push(lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slackURL || slackUsername) {
|
if (slackURL || slackUsername) {
|
||||||
const slack = slackURL || slackUsername;
|
const slack = slackURL || slackUsername;
|
||||||
@ -122,10 +82,5 @@ module.exports.forSettings = (attrs, frame) => {
|
|||||||
|
|
||||||
attrs.push(slack);
|
attrs.push(slack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locale) {
|
|
||||||
locale.key = 'locale';
|
|
||||||
attrs.push(locale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1082,26 +1082,6 @@ Object {
|
|||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||||
"value": true,
|
"value": true,
|
||||||
},
|
},
|
||||||
Object {
|
|
||||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"flags": null,
|
|
||||||
"group": "site",
|
|
||||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
|
||||||
"key": "active_timezone",
|
|
||||||
"type": "string",
|
|
||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"value": "Etc/UTC",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"flags": null,
|
|
||||||
"group": "site",
|
|
||||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
|
||||||
"key": "default_locale",
|
|
||||||
"type": "string",
|
|
||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"value": "en",
|
|
||||||
},
|
|
||||||
Object {
|
Object {
|
||||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||||
"flags": null,
|
"flags": null,
|
||||||
@ -1112,16 +1092,6 @@ Object {
|
|||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||||
"value": "[{\\"url\\":\\"\\",\\"username\\":\\"Ghost\\"}]",
|
"value": "[{\\"url\\":\\"\\",\\"username\\":\\"Ghost\\"}]",
|
||||||
},
|
},
|
||||||
Object {
|
|
||||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"flags": null,
|
|
||||||
"group": "site",
|
|
||||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
|
||||||
"key": "locale",
|
|
||||||
"type": "string",
|
|
||||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
|
||||||
"value": "en",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -1130,7 +1100,7 @@ exports[`Settings API Can request all settings 1: [headers] 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||||
"content-length": "18219",
|
"content-length": "18287",
|
||||||
"content-type": "application/json; charset=utf-8",
|
"content-type": "application/json; charset=utf-8",
|
||||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||||
"vary": "Origin, Accept-Encoding",
|
"vary": "Origin, Accept-Encoding",
|
||||||
@ -1142,7 +1112,7 @@ exports[`Settings API Can request all settings 2: [headers] 1`] = `
|
|||||||
Object {
|
Object {
|
||||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||||
"content-length": "18867",
|
"content-length": "18287",
|
||||||
"content-type": "application/json; charset=utf-8",
|
"content-type": "application/json; charset=utf-8",
|
||||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||||
"vary": "Origin, Accept-Encoding",
|
"vary": "Origin, Accept-Encoding",
|
||||||
|
@ -2,7 +2,7 @@ const assert = require('assert');
|
|||||||
const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework');
|
const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework');
|
||||||
const {stringMatching, anyEtag, anyObjectId, anyISODateTime} = matchers;
|
const {stringMatching, anyEtag, anyObjectId, anyISODateTime} = matchers;
|
||||||
|
|
||||||
const CURRENT_SETTINGS_COUNT = 89;
|
const CURRENT_SETTINGS_COUNT = 86;
|
||||||
|
|
||||||
const settingsMatcher = {
|
const settingsMatcher = {
|
||||||
id: anyObjectId,
|
id: anyObjectId,
|
||||||
|
@ -39,11 +39,6 @@ const defaultSettingsKeyTypes = [
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
group: 'site'
|
group: 'site'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'locale',
|
|
||||||
type: 'string',
|
|
||||||
group: 'site'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'timezone',
|
key: 'timezone',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@ -339,16 +334,6 @@ const defaultSettingsKeyTypes = [
|
|||||||
type: 'array',
|
type: 'array',
|
||||||
group: 'views'
|
group: 'views'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'active_timezone',
|
|
||||||
type: 'string',
|
|
||||||
group: 'site'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'default_locale',
|
|
||||||
type: 'string',
|
|
||||||
group: 'site'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'accent_color',
|
key: 'accent_color',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@ -469,7 +454,6 @@ describe('Settings API (canary)', function () {
|
|||||||
jsonResponse.settings.should.be.an.Object();
|
jsonResponse.settings.should.be.an.Object();
|
||||||
const settings = jsonResponse.settings;
|
const settings = jsonResponse.settings;
|
||||||
|
|
||||||
should.equal(settings.length, (defaultSettingsKeyTypes.length + calculatedSettingsTypes.length));
|
|
||||||
for (const defaultSetting of defaultSettingsKeyTypes) {
|
for (const defaultSetting of defaultSettingsKeyTypes) {
|
||||||
should.exist(settings.find((setting) => {
|
should.exist(settings.find((setting) => {
|
||||||
return (setting.key === defaultSetting.key)
|
return (setting.key === defaultSetting.key)
|
||||||
@ -478,6 +462,8 @@ describe('Settings API (canary)', function () {
|
|||||||
}), `Expected to find a setting with key ${defaultSetting.key}, type ${defaultSetting.type}, and group ${defaultSetting.group}`);
|
}), `Expected to find a setting with key ${defaultSetting.key}, type ${defaultSetting.type}, and group ${defaultSetting.group}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
should.equal(settings.length, (defaultSettingsKeyTypes.length + calculatedSettingsTypes.length));
|
||||||
|
|
||||||
const unsplash = settings.find(s => s.key === 'unsplash');
|
const unsplash = settings.find(s => s.key === 'unsplash');
|
||||||
should.exist(unsplash);
|
should.exist(unsplash);
|
||||||
unsplash.value.should.equal(true);
|
unsplash.value.should.equal(true);
|
||||||
@ -693,69 +679,6 @@ describe('Settings API (canary)', function () {
|
|||||||
jsonResponse.settings[0].value.should.match(jsonObjectRegex);
|
jsonResponse.settings[0].value.should.match(jsonObjectRegex);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can read deprecated default_locale', function (done) {
|
|
||||||
request.get(localUtils.API.getApiQuery('settings/default_locale/'))
|
|
||||||
.set('Origin', config.get('url'))
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
||||||
.expect(200)
|
|
||||||
.end(function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
return done(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
should.not.exist(res.headers['x-cache-invalidate']);
|
|
||||||
const jsonResponse = res.body;
|
|
||||||
|
|
||||||
should.exist(jsonResponse);
|
|
||||||
should.exist(jsonResponse.settings);
|
|
||||||
|
|
||||||
jsonResponse.settings.length.should.eql(1);
|
|
||||||
|
|
||||||
testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
|
||||||
jsonResponse.settings[0].key.should.eql('default_locale');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Can edit deprecated default_locale setting', function () {
|
|
||||||
return request.get(localUtils.API.getApiQuery('settings/default_locale/'))
|
|
||||||
.set('Origin', config.get('url'))
|
|
||||||
.set('Accept', 'application/json')
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
||||||
.then(function (res) {
|
|
||||||
let jsonResponse = res.body;
|
|
||||||
const newValue = 'new value';
|
|
||||||
should.exist(jsonResponse);
|
|
||||||
should.exist(jsonResponse.settings);
|
|
||||||
jsonResponse.settings = [{key: 'default_locale', value: 'ua'}];
|
|
||||||
|
|
||||||
return jsonResponse;
|
|
||||||
})
|
|
||||||
.then((editedSetting) => {
|
|
||||||
return request.put(localUtils.API.getApiQuery('settings/'))
|
|
||||||
.set('Origin', config.get('url'))
|
|
||||||
.send(editedSetting)
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
||||||
.expect(200)
|
|
||||||
.then(function (res) {
|
|
||||||
should.exist(res.headers['x-cache-invalidate']);
|
|
||||||
const jsonResponse = res.body;
|
|
||||||
|
|
||||||
should.exist(jsonResponse);
|
|
||||||
should.exist(jsonResponse.settings);
|
|
||||||
|
|
||||||
jsonResponse.settings.length.should.eql(1);
|
|
||||||
|
|
||||||
testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
|
||||||
jsonResponse.settings[0].key.should.eql('default_locale');
|
|
||||||
jsonResponse.settings[0].value.should.eql('ua');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Can edit deprecated lang setting', function () {
|
it('Can edit deprecated lang setting', function () {
|
||||||
return request.get(localUtils.API.getApiQuery('settings/lang/'))
|
return request.get(localUtils.API.getApiQuery('settings/lang/'))
|
||||||
.set('Origin', config.get('url'))
|
.set('Origin', config.get('url'))
|
||||||
@ -793,42 +716,43 @@ describe('Settings API (canary)', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can edit newly introduced locale setting', function () {
|
// @TODO: swap this test for the one above when renaming the setting is in place
|
||||||
return request.get(localUtils.API.getApiQuery('settings/locale/'))
|
// it('Can edit newly introduced locale setting', function () {
|
||||||
.set('Origin', config.get('url'))
|
// return request.get(localUtils.API.getApiQuery('settings/locale/'))
|
||||||
.set('Accept', 'application/json')
|
// .set('Origin', config.get('url'))
|
||||||
.expect('Content-Type', /json/)
|
// .set('Accept', 'application/json')
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
// .expect('Content-Type', /json/)
|
||||||
.then(function (res) {
|
// .expect('Cache-Control', testUtils.cacheRules.private)
|
||||||
let jsonResponse = res.body;
|
// .then(function (res) {
|
||||||
should.exist(jsonResponse);
|
// let jsonResponse = res.body;
|
||||||
should.exist(jsonResponse.settings);
|
// should.exist(jsonResponse);
|
||||||
jsonResponse.settings = [{key: 'locale', value: 'ge'}];
|
// should.exist(jsonResponse.settings);
|
||||||
|
// jsonResponse.settings = [{key: 'locale', value: 'ge'}];
|
||||||
|
|
||||||
return jsonResponse;
|
// return jsonResponse;
|
||||||
})
|
// })
|
||||||
.then((editedSetting) => {
|
// .then((editedSetting) => {
|
||||||
return request.put(localUtils.API.getApiQuery('settings/'))
|
// return request.put(localUtils.API.getApiQuery('settings/'))
|
||||||
.set('Origin', config.get('url'))
|
// .set('Origin', config.get('url'))
|
||||||
.send(editedSetting)
|
// .send(editedSetting)
|
||||||
.expect('Content-Type', /json/)
|
// .expect('Content-Type', /json/)
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
// .expect('Cache-Control', testUtils.cacheRules.private)
|
||||||
.expect(200)
|
// .expect(200)
|
||||||
.then(function (res) {
|
// .then(function (res) {
|
||||||
should.exist(res.headers['x-cache-invalidate']);
|
// should.exist(res.headers['x-cache-invalidate']);
|
||||||
const jsonResponse = res.body;
|
// const jsonResponse = res.body;
|
||||||
|
|
||||||
should.exist(jsonResponse);
|
// should.exist(jsonResponse);
|
||||||
should.exist(jsonResponse.settings);
|
// should.exist(jsonResponse.settings);
|
||||||
|
|
||||||
jsonResponse.settings.length.should.eql(1);
|
// jsonResponse.settings.length.should.eql(1);
|
||||||
|
|
||||||
testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
// testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
||||||
jsonResponse.settings[0].key.should.eql('locale');
|
// jsonResponse.settings[0].key.should.eql('locale');
|
||||||
jsonResponse.settings[0].value.should.eql('ge');
|
// jsonResponse.settings[0].value.should.eql('ge');
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
it('Can read timezone', function (done) {
|
it('Can read timezone', function (done) {
|
||||||
request.get(localUtils.API.getApiQuery('settings/timezone/'))
|
request.get(localUtils.API.getApiQuery('settings/timezone/'))
|
||||||
@ -855,56 +779,6 @@ describe('Settings API (canary)', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can read active_timezone', function (done) {
|
|
||||||
request.get(localUtils.API.getApiQuery('settings/active_timezone/'))
|
|
||||||
.set('Origin', config.get('url'))
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
||||||
.expect(200)
|
|
||||||
.end(function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
return done(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
should.not.exist(res.headers['x-cache-invalidate']);
|
|
||||||
const jsonResponse = res.body;
|
|
||||||
|
|
||||||
should.exist(jsonResponse);
|
|
||||||
should.exist(jsonResponse.settings);
|
|
||||||
|
|
||||||
jsonResponse.settings.length.should.eql(1);
|
|
||||||
|
|
||||||
testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
|
||||||
jsonResponse.settings[0].key.should.eql('active_timezone');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Can read deprecated active_timezone', function (done) {
|
|
||||||
request.get(localUtils.API.getApiQuery('settings/active_timezone/'))
|
|
||||||
.set('Origin', config.get('url'))
|
|
||||||
.expect('Content-Type', /json/)
|
|
||||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
||||||
.expect(200)
|
|
||||||
.end(function (err, res) {
|
|
||||||
if (err) {
|
|
||||||
return done(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
should.not.exist(res.headers['x-cache-invalidate']);
|
|
||||||
const jsonResponse = res.body;
|
|
||||||
|
|
||||||
should.exist(jsonResponse);
|
|
||||||
should.exist(jsonResponse.settings);
|
|
||||||
|
|
||||||
jsonResponse.settings.length.should.eql(1);
|
|
||||||
|
|
||||||
testUtils.API.checkResponseValue(jsonResponse.settings[0], ['id', 'group', 'key', 'value', 'type', 'flags', 'created_at', 'updated_at']);
|
|
||||||
jsonResponse.settings[0].key.should.eql('active_timezone');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Can read slack renamed&reformatted in v4', function (done) {
|
it('Can read slack renamed&reformatted in v4', function (done) {
|
||||||
request.get(localUtils.API.getApiQuery('settings/slack/'))
|
request.get(localUtils.API.getApiQuery('settings/slack/'))
|
||||||
.set('Origin', config.get('url'))
|
.set('Origin', config.get('url'))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{lang}}">
|
<html lang="{{@site.locale}}">
|
||||||
<head>
|
<head>
|
||||||
{{ghost_head}}
|
{{ghost_head}}
|
||||||
</head>
|
</head>
|
||||||
|
Loading…
Reference in New Issue
Block a user