diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index ab60927d016..caddf1ab807 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1596,6 +1596,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" + approve_unless_staged: "New topics and posts for staged users 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, send a notification to all moderators. Set to 0 to disable these notifications." 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 3c94c326eae..2521003002f 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -646,6 +646,8 @@ posting: approve_new_topics_unless_trust_level: default: 0 enum: 'TrustLevelSetting' + approve_unless_staged: + default: false notify_about_queued_posts_after: default: 24 auto_close_messages_post_count: 500 diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rb index 8eb03d32b6e..b6965bc221e 100644 --- a/lib/new_post_manager.rb +++ b/lib/new_post_manager.rb @@ -68,7 +68,7 @@ class NewPostManager end def self.exempt_user?(user) - user.staff? || user.staged + user.staff? end def self.post_needs_approval?(manager) @@ -81,7 +81,8 @@ class NewPostManager (manager.args[:title].present? && user.trust_level < SiteSetting.approve_new_topics_unless_trust_level.to_i) || is_fast_typer?(manager) || matches_auto_silence_regex?(manager) || - WordWatcher.new("#{manager.args[:title]} #{manager.args[:raw]}").requires_approval? + WordWatcher.new("#{manager.args[:title]} #{manager.args[:raw]}").requires_approval? || + (SiteSetting.approve_unless_staged && user.staged) end def self.default_handler(manager) @@ -123,6 +124,7 @@ class NewPostManager SiteSetting.approve_post_count > 0 || SiteSetting.approve_unless_trust_level.to_i > 0 || SiteSetting.approve_new_topics_unless_trust_level.to_i > 0 || + SiteSetting.approve_unless_staged || WordWatcher.words_for_action_exists?(:require_approval) || handlers.size > 1 end diff --git a/spec/components/new_post_manager_spec.rb b/spec/components/new_post_manager_spec.rb index 65aee5054f0..22218a67dc5 100644 --- a/spec/components/new_post_manager_spec.rb +++ b/spec/components/new_post_manager_spec.rb @@ -115,6 +115,18 @@ describe NewPostManager do end end + context 'with staged moderation setting enabled' do + before do + SiteSetting.approve_unless_staged = true + topic.user.staged = true + end + it "will return an enqueue result" do + result = NewPostManager.default_handler(manager) + expect(NewPostManager.queue_enabled?).to eq(true) + expect(result.action).to eq(:enqueued) + end + end + context 'with a high trust level setting for new topics but post responds to existing topic' do before do SiteSetting.approve_new_topics_unless_trust_level = 4