mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 11:36:01 +08:00
DEV: Refactor setting component save callback (#8261)
* DEV: Refactor setting component save callback * refactor site-setting component around new callback * add callback to theme-translation component * remove the save callback altogether
This commit is contained in:

committed by
GitHub

parent
29e41dc511
commit
0a499966e9
@ -111,23 +111,21 @@ export default Ember.Mixin.create({
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
this._save(result => {
|
||||
result
|
||||
.then(() => {
|
||||
this.set("validationMessage", null);
|
||||
this.commitBuffer();
|
||||
if (AUTO_REFRESH_ON_SAVE.includes(this.setting.setting)) {
|
||||
this.afterSave();
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {
|
||||
this.set("validationMessage", e.jqXHR.responseJSON.errors[0]);
|
||||
} else {
|
||||
this.set("validationMessage", I18n.t("generic_error"));
|
||||
}
|
||||
});
|
||||
});
|
||||
this._save()
|
||||
.then(() => {
|
||||
this.set("validationMessage", null);
|
||||
this.commitBuffer();
|
||||
if (AUTO_REFRESH_ON_SAVE.includes(this.setting.setting)) {
|
||||
this.afterSave();
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {
|
||||
this.set("validationMessage", e.jqXHR.responseJSON.errors[0]);
|
||||
} else {
|
||||
this.set("validationMessage", I18n.t("generic_error"));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
|
Reference in New Issue
Block a user