Skip to content

Commit

Permalink
FIX: Show staff bulk actions only to staff (#12823)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nbianca committed Apr 26, 2021
1 parent d53307b commit 7c3268e
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -77,20 +77,32 @@ addBulkButton("showTagTopics", "change_tags", {
icon: "tag",
class: "btn-default",
enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
});
addBulkButton("showAppendTagTopics", "append_tags", {
icon: "tag",
class: "btn-default",
enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
});
addBulkButton("removeTags", "remove_tags", {
icon: "tag",
class: "btn-default",
enabledSetting: "tagging_enabled",
buttonVisible: function () {
return this.currentUser.staff;
},
});
addBulkButton("deleteTopics", "delete", {
icon: "trash-alt",
class: "btn-danger",
buttonVisible: function () {
return this.currentUser.staff;
},
});

// Modal for performing bulk actions on topics
Expand All @@ -112,7 +124,7 @@ export default Controller.extend(ModalFunctionality, {
if (b.enabledSetting && !this.siteSettings[b.enabledSetting]) {
return false;
}
return b.buttonVisible(topics);
return b.buttonVisible.call(this, topics);
})
);
this.set("modal.modalClass", "topic-bulk-actions-modal small");
Expand Down

0 comments on commit 7c3268e

Please sign in to comment.