REFACTOR: improve the code readability. (#8211)

b2f682f35e
This commit is contained in:
Vinoth Kannan 2019-10-17 22:05:44 +05:30 committed by GitHub
parent bd969332e0
commit 3cdcd093ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 21 deletions

View File

@ -5,14 +5,6 @@ import showModal from "discourse/lib/show-modal";
import AboutRoute from "discourse/routes/about";
export default Ember.Component.extend(BufferedContent, SettingComponent, {
update(key, value, updateExistingUsers = false) {
if (updateExistingUsers) {
return SiteSetting.update(key, value, { updateExistingUsers: true });
} else {
return SiteSetting.update(key, value);
}
},
_save(callback) {
const defaultCategoriesSettings = [
"default_categories_watching",
@ -36,19 +28,16 @@ export default Ember.Component.extend(BufferedContent, SettingComponent, {
admin: true
});
controller.setProperties({
onClose: () => {
const updateExistingUsers = controller.get("updateExistingUsers");
if (updateExistingUsers === true) {
callback(this.update(key, value, true));
} else if (updateExistingUsers === false) {
callback(this.update(key, value));
}
}
controller.set("onClose", () => {
callback(
SiteSetting.update(key, value, {
updateExistingUsers: controller.updateExistingUsers
})
);
});
});
} else {
callback(this.update(key, value));
callback(SiteSetting.update(key, value));
}
}
});

View File

@ -116,7 +116,7 @@ export default Ember.Mixin.create({
.then(() => {
this.set("validationMessage", null);
this.commitBuffer();
if (AUTO_REFRESH_ON_SAVE.includes(this.get("setting.setting"))) {
if (AUTO_REFRESH_ON_SAVE.includes(this.setting.setting)) {
this.afterSave();
}
})

View File

@ -3,6 +3,6 @@
{{/d-modal-body}}
<div class="modal-footer">
{{d-button action=(action "updateExistingUsers") class='btn btn-primary' label='admin.site_settings.default_categories.modal_yes'}}
{{d-button action=(action "cancel") class='btn' label='admin.site_settings.default_categories.modal_no'}}
{{d-button action=(action "updateExistingUsers") class='btn-primary' label='admin.site_settings.default_categories.modal_yes'}}
{{d-button action=(action "cancel") label='admin.site_settings.default_categories.modal_no'}}
</div>