diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js index 3ef81b78..afa86973 100644 --- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js +++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js @@ -174,7 +174,11 @@ function registerTopicFooterButtons(api) { }, displayed() { - return !this.site.mobileView && this.topic.isAssigned(); + return ( + this.get("currentUser.can_assign") && + !this.site.mobileView && + this.topic.isAssigned() + ); }, }); diff --git a/test/javascripts/acceptance/assigned-topic-test.js b/test/javascripts/acceptance/assigned-topic-test.js index 2ae8d235..90de34ca 100644 --- a/test/javascripts/acceptance/assigned-topic-test.js +++ b/test/javascripts/acceptance/assigned-topic-test.js @@ -78,6 +78,7 @@ acceptance("Discourse Assign | Assigned topic", function (needs) { assign_enabled: true, tagging_enabled: true, assigns_user_url_path: "/", + assigns_public: true, }); assignCurrentUserToTopic(needs); @@ -123,6 +124,16 @@ acceptance("Discourse Assign | Assigned topic", function (needs) { "shows reassign dropdown at the bottom of the topic" ); }); + + test("User without assign ability cannot see footer button", async (assert) => { + updateCurrentUser({ can_assign: false, admin: false, moderator: false }); + await visit("/t/assignment-topic/45"); + + assert.notOk( + exists("#topic-footer-dropdown-reassign"), + "does not show reassign dropdown at the bottom of the topic" + ); + }); }); acceptance("Discourse Assign | Re-assign topic", function (needs) {