Skip to content

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

FIX: Show a nicer message when there aren't any flagged topics.

Robin Ward84cc52d8fccc
diff --git a/app/assets/javascripts/admin/templates/flags-topics-index.hbs b/app/assets/javascripts/admin/templates/flags-topics-index.hbs
index b5a7eca133e..5ece61b6b72 100644
--- a/app/assets/javascripts/admin/templates/flags-topics-index.hbs
+++ b/app/assets/javascripts/admin/templates/flags-topics-index.hbs
@@ -1,46 +1,50 @@
{{plugin-outlet name="flagged-topics-before" noTags=true args=(hash flaggedTopics=flaggedTopics)}}
-<table class='flagged-topics'>
- <thead>
- {{plugin-outlet name="flagged-topic-header-row" noTags=true}}
- <th>{{i18n "admin.flags.flagged_topics.topic"}} </th>
- <th>{{i18n "admin.flags.flagged_topics.type"}}</th>
- <th>{{I18n "admin.flags.flagged_topics.users"}}</th>
- <th>{{i18n "admin.flags.flagged_topics.last_flagged"}}</th>
- <th></th>
- </thead>
+{{#if flaggedTopics}}
+ <table class='flagged-topics'>
+ <thead>
+ {{plugin-outlet name="flagged-topic-header-row" noTags=true}}
+ <th>{{i18n "admin.flags.flagged_topics.topic"}} </th>
+ <th>{{i18n "admin.flags.flagged_topics.type"}}</th>
+ <th>{{I18n "admin.flags.flagged_topics.users"}}</th>
+ <th>{{i18n "admin.flags.flagged_topics.last_flagged"}}</th>
+ <th></th>
+ </thead>
- {{#each flaggedTopics as |ft|}}
- <tr class='flagged-topic'>
- {{plugin-outlet name="flagged-topic-row" noTags=true args=(hash topic=ft.topic)}}
+ {{#each flaggedTopics as |ft|}}
+ <tr class='flagged-topic'>
+ {{plugin-outlet name="flagged-topic-row" noTags=true args=(hash topic=ft.topic)}}
- <td class="topic-title">
- <a href={{ft.topic.relative_url}} target="_blank">{{replace-emoji ft.topic.fancy_title}}</a>
- </td>
- <td>
- {{#each ft.flag_counts as |fc|}}
- <div class='flag-counts'>
- <span class='type-name'>{{post-action-title fc.post_action_type_id fc.name_key}}</span>
- <span class='type-count'>x{{fc.count}}</span>
- </div>
- {{/each}}
- </td>
- <td class='flagged-topic-users'>
- {{flagged-topic-users users=ft.users tagName=""}}
- </td>
- <td>
- {{format-age ft.last_flag_at}}
- </td>
- <td>
- {{#link-to
- "adminFlags.topics.show"
- ft.id
- class="btn d-button no-text btn-small btn-primary show-details"
- title=(i18n "admin.flags.show_details")}}
- {{d-icon "list"}}
- {{i18n "admin.flags.details"}}
- {{/link-to}}
- </td>
- </tr>
- {{/each}}
-</table>
+ <td class="topic-title">
+ <a href={{ft.topic.relative_url}} target="_blank">{{replace-emoji ft.topic.fancy_title}}</a>
+ </td>
+ <td>
+ {{#each ft.flag_counts as |fc|}}
+ <div class='flag-counts'>
+ <span class='type-name'>{{post-action-title fc.post_action_type_id fc.name_key}}</span>
+ <span class='type-count'>x{{fc.count}}</span>
+ </div>
+ {{/each}}
+ </td>
+ <td class='flagged-topic-users'>
+ {{flagged-topic-users users=ft.users tagName=""}}
+ </td>
+ <td>
+ {{format-age ft.last_flag_at}}
+ </td>
+ <td>
+ {{#link-to
+ "adminFlags.topics.show"
+ ft.id
+ class="btn d-button no-text btn-small btn-primary show-details"
+ title=(i18n "admin.flags.show_details")}}
+ {{d-icon "list"}}
+ {{i18n "admin.flags.details"}}
+ {{/link-to}}
+ </td>
+ </tr>
+ {{/each}}
+ </table>
+{{else}}
+ {{i18n "admin.flags.flagged_topics.no_results"}}
+{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 3b3cc7d890b..048a7368830 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2837,6 +2837,7 @@ en:
type: "Type"
users: "Users"
last_flagged: "Last Flagged"
+ no_results: "There are no flagged topics."
short_names:
off_topic: "off-topic"