FIX: Do not show topic admin menu button to regular users (#26820)

This commit is contained in:
Jan Cernik 2024-04-30 11:47:36 -05:00 committed by GitHub
parent 3930064fd1
commit ff8e1f4ed6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 236 additions and 215 deletions

View File

@ -72,7 +72,16 @@ export default class TopicAdminMenu extends Component {
return getURL(`/review?topic_id=${this.args.topic.id}&status=all`);
}
get showAdminButton() {
return (
this.currentUser?.canManageTopic ||
this.details?.can_archive_topic ||
this.details?.can_close_topic
);
}
<template>
{{#if this.showAdminButton}}
<span class="topic-admin-menu-button-container">
<span class="topic-admin-menu-button">
<DMenu
@ -174,7 +183,8 @@ export default class TopicAdminMenu extends Component {
{{#if
(and
this.details.can_archive_topic (not this.isPrivateMessage)
this.details.can_archive_topic
(not this.isPrivateMessage)
)
}}
<li class="topic-admin-archive">
@ -223,7 +233,11 @@ export default class TopicAdminMenu extends Component {
"convertToPrivateMessage"
)
}}
@icon={{if this.isPrivateMessage "comment" "envelope"}}
@icon={{if
this.isPrivateMessage
"comment"
"envelope"
}}
/>
</li>
{{/if}}
@ -235,7 +249,10 @@ export default class TopicAdminMenu extends Component {
<DButton
class="btn-transparent"
@label="topic.actions.timed_update"
@action={{fn this.onButtonAction "showTopicTimerModal"}}
@action={{fn
this.onButtonAction
"showTopicTimerModal"
}}
@icon="far-clock"
/>
</li>
@ -295,7 +312,10 @@ export default class TopicAdminMenu extends Component {
@label={{button.label}}
@translatedLabel={{button.translatedLabel}}
@icon={{button.icon}}
class={{concatClass "btn-transparent" button.className}}
class={{concatClass
"btn-transparent"
button.className
}}
@action={{fn this.onExtraButtonAction button.action}}
/>
</li>
@ -307,5 +327,6 @@ export default class TopicAdminMenu extends Component {
</DMenu>
</span>
</span>
{{/if}}
</template>
}