mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 00:35:31 +08:00
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import BufferedContent from "discourse/mixins/buffered-content";
|
|
import SiteSetting from "admin/models/site-setting";
|
|
import SettingComponent from "admin/mixins/setting-component";
|
|
import showModal from "discourse/lib/show-modal";
|
|
import AboutRoute from "discourse/routes/about";
|
|
|
|
export default Ember.Component.extend(BufferedContent, SettingComponent, {
|
|
_save(callback) {
|
|
const defaultCategoriesSettings = [
|
|
"default_categories_watching",
|
|
"default_categories_tracking",
|
|
"default_categories_muted",
|
|
"default_categories_watching_first_post"
|
|
];
|
|
const setting = this.buffered;
|
|
const key = setting.get("setting");
|
|
const value = setting.get("value");
|
|
|
|
if (defaultCategoriesSettings.includes(key)) {
|
|
AboutRoute.create()
|
|
.model()
|
|
.then(result => {
|
|
const controller = showModal("site-setting-default-categories", {
|
|
model: {
|
|
count: result.stats.user_count,
|
|
key: key.replace(/_/g, " ")
|
|
},
|
|
admin: true
|
|
});
|
|
|
|
controller.set("onClose", () => {
|
|
callback(
|
|
SiteSetting.update(key, value, {
|
|
updateExistingUsers: controller.updateExistingUsers
|
|
})
|
|
);
|
|
});
|
|
});
|
|
} else {
|
|
callback(SiteSetting.update(key, value));
|
|
}
|
|
}
|
|
});
|