FIX: Hide footer action button when user cannot assign (#319)
This commit is contained in:
parent
3a147fcb88
commit
21d89179ea
|
|
@ -174,7 +174,11 @@ function registerTopicFooterButtons(api) {
|
||||||
},
|
},
|
||||||
|
|
||||||
displayed() {
|
displayed() {
|
||||||
return !this.site.mobileView && this.topic.isAssigned();
|
return (
|
||||||
|
this.get("currentUser.can_assign") &&
|
||||||
|
!this.site.mobileView &&
|
||||||
|
this.topic.isAssigned()
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ acceptance("Discourse Assign | Assigned topic", function (needs) {
|
||||||
assign_enabled: true,
|
assign_enabled: true,
|
||||||
tagging_enabled: true,
|
tagging_enabled: true,
|
||||||
assigns_user_url_path: "/",
|
assigns_user_url_path: "/",
|
||||||
|
assigns_public: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
assignCurrentUserToTopic(needs);
|
assignCurrentUserToTopic(needs);
|
||||||
|
|
@ -123,6 +124,16 @@ acceptance("Discourse Assign | Assigned topic", function (needs) {
|
||||||
"shows reassign dropdown at the bottom of the topic"
|
"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) {
|
acceptance("Discourse Assign | Re-assign topic", function (needs) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue