Skip to content

A platform for community discussion. Free, open, simple.

FIX: Do not show empty list in the topic admin menu (#26825)

Jan Cernikddf7bbfa9738
diff --git a/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs b/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
index 2546907524f..d6321738cde 100644
--- a/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-admin-menu.gjs
@@ -294,33 +294,38 @@ export default class TopicAdminMenu extends Component {
{{/if}}
</ul>
- <ul class="topic-admin-menu-undefined">
- {{#if this.currentUser.staff}}
- <li class="topic-admin-moderation-history">
- <DButton
- class="btn-transparent"
- @label="review.moderation_history"
- @href={{this.topicModerationHistoryUrl}}
- @icon="list"
- />
- </li>
- {{/if}}
+ {{#if (or this.currentUser.staff this.extraButtons.length)}}
+ <ul class="topic-admin-menu-undefined">
+ {{#if this.currentUser.staff}}
+ <li class="topic-admin-moderation-history">
+ <DButton
+ class="btn-transparent"
+ @label="review.moderation_history"
+ @href={{this.topicModerationHistoryUrl}}
+ @icon="list"
+ />
+ </li>
+ {{/if}}
- {{#each this.extraButtons as |button|}}
- <li>
- <DButton
- @label={{button.label}}
- @translatedLabel={{button.translatedLabel}}
- @icon={{button.icon}}
- class={{concatClass
- "btn-transparent"
- button.className
- }}
- @action={{fn this.onExtraButtonAction button.action}}
- />
- </li>
- {{/each}}
- </ul>
+ {{#each this.extraButtons as |button|}}
+ <li>
+ <DButton
+ @label={{button.label}}
+ @translatedLabel={{button.translatedLabel}}
+ @icon={{button.icon}}
+ class={{concatClass
+ "btn-transparent"
+ button.className
+ }}
+ @action={{fn
+ this.onExtraButtonAction
+ button.action
+ }}
+ />
+ </li>
+ {{/each}}
+ </ul>
+ {{/if}}
</ul>
</div>
</:content>