FIX: Update Re-assign view permissions (#241)

Only show mobile re-assign options if user has permission to assign

Fixes: https://meta.discourse.org/t/discourse-assign/58044/155?u=isaacjanzen
This commit is contained in:
janzenisaac 2021-11-15 09:58:48 -06:00 committed by GitHub
parent ab0c63b1fb
commit 28fbcac11e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -238,7 +238,7 @@ function registerTopicFooterButtons(api) {
dependentKeys: DEPENDENT_KEYS,
displayed() {
// only display the button in the mobile view
return this.site.mobileView;
return this.currentUser?.can_assign && this.site.mobileView;
},
});
@ -282,7 +282,11 @@ function registerTopicFooterButtons(api) {
dependentKeys: DEPENDENT_KEYS,
displayed() {
// only display the button in the mobile view
return this.site.mobileView && this.topic.isAssigned();
return (
this.currentUser?.can_assign &&
this.site.mobileView &&
this.topic.isAssigned()
);
},
});
@ -328,6 +332,7 @@ function registerTopicFooterButtons(api) {
return (
// only display the button in the mobile view
this.site.mobileView &&
this.currentUser?.can_assign &&
this.topic.isAssigned() &&
this.get("topic.assigned_to_user")?.username !==
this.currentUser.username
@ -373,7 +378,7 @@ function registerTopicFooterButtons(api) {
dependentKeys: DEPENDENT_KEYS,
displayed() {
// only display the button in the mobile view
return this.site.mobileView;
return this.currentUser?.can_assign && this.site.mobileView;
},
});
}