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

View File

@ -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}`);
}
});

View File

@ -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}}

View File

@ -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',

View File

@ -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;">

View File

@ -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] %>

View File

@ -1358,6 +1358,7 @@ en:
auto_block_fast_typers_on_first_post: "Automatically block users that do not meet min_first_post_typing_time"
auto_block_fast_typers_max_trust_level: "Maximum trust level to auto block fast typers"
auto_block_first_post_regex: "Case insensitive regex that if passed will cause first post by user to be blocked and sent to approval queue. Example: raging|a[bc]a , will cause all posts containing raging or aba or aca to be blocked on first. Only applies to first post."
flags_default_topics: "Show flagged topics by default in the admin section"
reply_by_email_enabled: "Enable replying to topics via email."
reply_by_email_address: "Template for reply by email incoming email address, for example: %{reply_key}@reply.example.com or replies+%{reply_key}@example.com"

View File

@ -997,6 +997,9 @@ spam:
auto_block_fast_typers_on_first_post: true
auto_block_fast_typers_max_trust_level: 0
auto_block_first_post_regex: ""
flags_default_topics:
default: false
client: true
rate_limits:
unique_posts_mins: 5