FEATURE: Site Setting to determine whether flags defaults to topics

This commit is contained in:
Robin Ward
2017-10-20 12:37:20 -04:00
parent 9586f0bdc9
commit e9159e49f3
7 changed files with 30 additions and 14 deletions
@@ -1,5 +1,6 @@
export default Discourse.Route.extend({
redirect() {
this.replaceWith('adminFlags.postsActive');
let segment = this.siteSettings.flags_default_topics ? 'topics' : 'postsActive';
this.replaceWith(`adminFlags.${segment}`);
}
});
@@ -1,6 +1,12 @@
{{#admin-nav}}
{{nav-item route='adminFlags.postsActive' label='admin.flags.active_posts'}}
{{nav-item route='adminFlags.topics' label='admin.flags.topics'}}
{{#if siteSettings.flags_default_topics}}
{{nav-item route='adminFlags.topics' label='admin.flags.topics'}}
{{nav-item route='adminFlags.postsActive' label='admin.flags.active_posts'}}
{{else}}
{{nav-item route='adminFlags.postsActive' label='admin.flags.active_posts'}}
{{nav-item route='adminFlags.topics' label='admin.flags.topics'}}
{{/if}}
{{nav-item route='adminFlags.postsOld' label='admin.flags.old_posts' class='right'}}
{{/admin-nav}}
@@ -39,16 +39,21 @@ export default createWidget('hamburger-menu', {
},
adminLinks() {
const { currentUser } = this;
const { currentUser, siteSettings } = this;
let flagsPath = siteSettings.flags_default_topics ? 'topics' : 'active';
const links = [{ route: 'admin', className: 'admin-link', icon: 'wrench', label: 'admin_title' },
{ href: '/admin/flags/active',
className: 'flagged-posts-link',
icon: 'flag',
label: 'flags_title',
badgeClass: 'flagged-posts',
badgeTitle: 'notifications.total_flagged',
badgeCount: 'site_flagged_posts_count' }];
const links = [
{ route: 'admin', className: 'admin-link', icon: 'wrench', label: 'admin_title' },
{
href: `/admin/flags/${flagsPath}`,
className: 'flagged-posts-link',
icon: 'flag',
label: 'flags_title',
badgeClass: 'flagged-posts',
badgeTitle: 'notifications.total_flagged',
badgeCount: 'site_flagged_posts_count'
}
];
if (currentUser.show_queued_posts) {
links.push({ route: 'queued-posts',
@@ -1,6 +1,6 @@
<p>
<%= t 'flags_reminder.flags_were_submitted', count: @hours %>
<a href="<%= Discourse.base_url + '/admin/flags/active' %>"><%= t 'flags_reminder.please_review' %></a>
<a href="<%= Discourse.base_url + '/admin/flags' %>"><%= t 'flags_reminder.please_review' %></a>
</p>
<table style="border-collapse: collapse; border-spacing: 0;">
@@ -1,6 +1,6 @@
<%=t 'flags_reminder.flags_were_submitted', count: @hours %> <%=t 'flags_reminder.please_review' %>
<%= Discourse.base_url + '/admin/flags/active' %>
<%= Discourse.base_url + '/admin/flags' %>
<% @posts.each do |post| %>
- <%= post[:title] %>: <%=t 'flags_reminder.post_number' %> <%= post[:post_number] %> - <%= post[:reason_counts] %>