FIX: Show staff bulk actions only to staff (#12823)

The bulk button is normally shown only to staff, which is why we did not
do any explicit permissions check. Now we do display it on the messages
page too, where it is accessible to everyone.
This commit is contained in:
Bianca Nenciu 2021-04-26 12:40:52 +03:00 committed by GitHub
parent d53307b141
commit 7c3268e0c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -77,20 +77,32 @@ addBulkButton("showTagTopics", "change_tags", {
icon: "tag", icon: "tag",
class: "btn-default", class: "btn-default",
enabledSetting: "tagging_enabled", enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
}); });
addBulkButton("showAppendTagTopics", "append_tags", { addBulkButton("showAppendTagTopics", "append_tags", {
icon: "tag", icon: "tag",
class: "btn-default", class: "btn-default",
enabledSetting: "tagging_enabled", enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
}); });
addBulkButton("removeTags", "remove_tags", { addBulkButton("removeTags", "remove_tags", {
icon: "tag", icon: "tag",
class: "btn-default", class: "btn-default",
enabledSetting: "tagging_enabled", enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
}); });
addBulkButton("deleteTopics", "delete", { addBulkButton("deleteTopics", "delete", {
icon: "trash-alt", icon: "trash-alt",
class: "btn-danger", class: "btn-danger",
buttonVisible: function () {
return this.currentUser.staff;
},
}); });
// Modal for performing bulk actions on topics // Modal for performing bulk actions on topics
@ -112,7 +124,7 @@ export default Controller.extend(ModalFunctionality, {
if (b.enabledSetting && !this.siteSettings[b.enabledSetting]) { if (b.enabledSetting && !this.siteSettings[b.enabledSetting]) {
return false; return false;
} }
return b.buttonVisible(topics); return b.buttonVisible.call(this, topics);
}) })
); );
this.set("modal.modalClass", "topic-bulk-actions-modal small"); this.set("modal.modalClass", "topic-bulk-actions-modal small");