From 5dbb3035d4a56ad9f1d304a6fe559f6a9b59edf5 Mon Sep 17 00:00:00 2001 From: pmusaraj Date: Mon, 19 Sep 2016 14:07:15 -0400 Subject: [PATCH] add "Approve new topics unless user level" setting --- config/locales/server.en.yml | 1 + config/site_settings.yml | 3 +++ lib/new_post_manager.rb | 1 + 3 files changed, 5 insertions(+) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 96c5facc906..b205c482cae 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1353,6 +1353,7 @@ en: approve_post_count: "The amount of posts from a new or basic user that must be approved" approve_unless_trust_level: "Posts for users below this trust level must be approved" + approve_new_topics_unless_trust_level: "New topics for users below this trust level must be approved" notify_about_queued_posts_after: "If there are posts that have been waiting to be reviewed for more than this many hours, an email will be sent to the contact_email. Set to 0 to disable these emails." auto_close_messages_post_count: "Maximum number of posts allowed in a message before it is automatically closed (0 to disable)" auto_close_topics_post_count: "Maximum number of posts allowed in a topic before it is automatically closed (0 to disable)" diff --git a/config/site_settings.yml b/config/site_settings.yml index 25f92abde72..067933349c4 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -544,6 +544,9 @@ posting: approve_unless_trust_level: default: 0 enum: 'TrustLevelSetting' + approve_new_topics_unless_trust_level: + default: 0 + enum: 'TrustLevelSetting' notify_about_queued_posts_after: default: 24 min: 0 diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rb index 9d8c570fa33..026f7875737 100644 --- a/lib/new_post_manager.rb +++ b/lib/new_post_manager.rb @@ -73,6 +73,7 @@ class NewPostManager (user.trust_level <= TrustLevel.levels[:basic] && user.post_count < SiteSetting.approve_post_count) || (user.trust_level < SiteSetting.approve_unless_trust_level.to_i) || + (manager.args[:title].present? && user.trust_level < SiteSetting.approve_new_topics_unless_trust_level.to_i) || is_fast_typer?(manager) || matches_auto_block_regex?(manager) end