mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 20:18:23 -05:00
FEATURE: Site settings defaults per locale
This change-set allows setting different defaults for different locales. It also: - Adds extensive testing around site setting validation - raises deprecation error if site setting has the default property based on env - relocated site settings for dev and tests in the initializer - deprecated client_setting in the site setting's loading process - ensure it raises when a enum site setting being set - default_locale is promoted to `required` category. - fixes incorrect default setting and validation - fixes ensure type check for site settings - creates a benchmark for site setting - sets reasonable defaults for Chinese
This commit is contained in:
@@ -52,16 +52,16 @@ export default Ember.Component.extend(BufferedContent, {
|
||||
}.on("willDestroyElement"),
|
||||
|
||||
_save() {
|
||||
const self = this,
|
||||
setting = this.get('buffered');
|
||||
SiteSetting.update(setting.get('setting'), setting.get('value')).then(function() {
|
||||
self.set('validationMessage', null);
|
||||
self.commitBuffer();
|
||||
}).catch(function(e) {
|
||||
const setting = this.get('buffered'),
|
||||
action = SiteSetting.update(setting.get('setting'), setting.get('value'));
|
||||
action.then(() => {
|
||||
this.set('validationMessage', null);
|
||||
this.commitBuffer();
|
||||
}).catch((e) => {
|
||||
if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {
|
||||
self.set('validationMessage', e.jqXHR.responseJSON.errors[0]);
|
||||
this.set('validationMessage', e.jqXHR.responseJSON.errors[0]);
|
||||
} else {
|
||||
self.set('validationMessage', I18n.t('generic_error'));
|
||||
this.set('validationMessage', I18n.t('generic_error'));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ SiteSetting.reopenClass({
|
||||
update(key, value) {
|
||||
const data = {};
|
||||
data[key] = value;
|
||||
return ajax("/admin/site_settings/" + key, { type: 'PUT', data });
|
||||
return ajax(`/admin/site_settings/${key}`, { type: 'PUT', data });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user