mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Remove Discourse.SiteSettings
from topic bulk actions
This commit is contained in:
parent
5b7c016ebc
commit
37f2611d9c
@ -19,6 +19,7 @@ function addBulkButton(action, key, opts) {
|
|||||||
label: `topics.bulk.${key}`,
|
label: `topics.bulk.${key}`,
|
||||||
icon: opts.icon,
|
icon: opts.icon,
|
||||||
buttonVisible: opts.buttonVisible || alwaysTrue,
|
buttonVisible: opts.buttonVisible || alwaysTrue,
|
||||||
|
enabledSetting: opts.enabledSetting,
|
||||||
class: opts.class
|
class: opts.class
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,16 +57,16 @@ addBulkButton("relistTopics", "relist_topics", {
|
|||||||
class: "btn-default",
|
class: "btn-default",
|
||||||
buttonVisible: topics => topics.some(t => !t.visible)
|
buttonVisible: topics => topics.some(t => !t.visible)
|
||||||
});
|
});
|
||||||
if (Discourse.SiteSettings.tagging_enabled) {
|
addBulkButton("showTagTopics", "change_tags", {
|
||||||
addBulkButton("showTagTopics", "change_tags", {
|
icon: "tag",
|
||||||
icon: "tag",
|
class: "btn-default",
|
||||||
class: "btn-default"
|
enabledSetting: "tagging_enabled"
|
||||||
});
|
});
|
||||||
addBulkButton("showAppendTagTopics", "append_tags", {
|
addBulkButton("showAppendTagTopics", "append_tags", {
|
||||||
icon: "tag",
|
icon: "tag",
|
||||||
class: "btn-default"
|
class: "btn-default",
|
||||||
});
|
enabledSetting: "tagging_enabled"
|
||||||
}
|
});
|
||||||
addBulkButton("deleteTopics", "delete", {
|
addBulkButton("deleteTopics", "delete", {
|
||||||
icon: "trash-alt",
|
icon: "trash-alt",
|
||||||
class: "btn-danger"
|
class: "btn-danger"
|
||||||
@ -80,11 +81,14 @@ export default Controller.extend(ModalFunctionality, {
|
|||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
const topics = this.get("model.topics");
|
const topics = this.get("model.topics");
|
||||||
// const relistButtonIndex = _buttons.findIndex(b => b.action === 'relistTopics');
|
|
||||||
|
|
||||||
this.set(
|
this.set(
|
||||||
"buttons",
|
"buttons",
|
||||||
_buttons.filter(b => b.buttonVisible(topics))
|
_buttons.filter(b => {
|
||||||
|
if (b.enabledSetting && !this.siteSettings[b.enabledSetting]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return b.buttonVisible(topics);
|
||||||
|
})
|
||||||
);
|
);
|
||||||
this.set("modal.modalClass", "topic-bulk-actions-modal small");
|
this.set("modal.modalClass", "topic-bulk-actions-modal small");
|
||||||
this.send("changeBulkTemplate", "modal/bulk-actions-buttons");
|
this.send("changeBulkTemplate", "modal/bulk-actions-buttons");
|
||||||
|
Loading…
Reference in New Issue
Block a user