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({ export default Discourse.Route.extend({
redirect() { 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}} {{#admin-nav}}
{{nav-item route='adminFlags.postsActive' label='admin.flags.active_posts'}} {{#if siteSettings.flags_default_topics}}
{{nav-item route='adminFlags.topics' label='admin.flags.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'}} {{nav-item route='adminFlags.postsOld' label='admin.flags.old_posts' class='right'}}
{{/admin-nav}} {{/admin-nav}}

View File

@ -39,16 +39,21 @@ export default createWidget('hamburger-menu', {
}, },
adminLinks() { 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' }, const links = [
{ href: '/admin/flags/active', { route: 'admin', className: 'admin-link', icon: 'wrench', label: 'admin_title' },
className: 'flagged-posts-link', {
icon: 'flag', href: `/admin/flags/${flagsPath}`,
label: 'flags_title', className: 'flagged-posts-link',
badgeClass: 'flagged-posts', icon: 'flag',
badgeTitle: 'notifications.total_flagged', label: 'flags_title',
badgeCount: 'site_flagged_posts_count' }]; badgeClass: 'flagged-posts',
badgeTitle: 'notifications.total_flagged',
badgeCount: 'site_flagged_posts_count'
}
];
if (currentUser.show_queued_posts) { if (currentUser.show_queued_posts) {
links.push({ route: 'queued-posts', links.push({ route: 'queued-posts',

View File

@ -1,6 +1,6 @@
<p> <p>
<%= t 'flags_reminder.flags_were_submitted', count: @hours %> <%= 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> </p>
<table style="border-collapse: collapse; border-spacing: 0;"> <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' %> <%=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| %> <% @posts.each do |post| %>
- <%= post[:title] %>: <%=t 'flags_reminder.post_number' %> <%= post[:post_number] %> - <%= post[:reason_counts] %> - <%= 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_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_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." 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_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" 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_on_first_post: true
auto_block_fast_typers_max_trust_level: 0 auto_block_fast_typers_max_trust_level: 0
auto_block_first_post_regex: "" auto_block_first_post_regex: ""
flags_default_topics:
default: false
client: true
rate_limits: rate_limits:
unique_posts_mins: 5 unique_posts_mins: 5