From be257225b649010e1ecf93168ef92e510251b419 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 2 Mar 2016 14:54:03 -0500 Subject: [PATCH] Adjustment: New User Posts must be reviewed at TL0 + TL1 --- config/locales/server.en.yml | 2 +- lib/new_post_manager.rb | 2 +- spec/components/new_post_manager_spec.rb | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index eb4d3f2e96c..490a94ff9b7 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1240,7 +1240,7 @@ en: emoji_set: "How would you like your emoji?" enforce_square_emoji: "Force a square aspect ratio to all emojis." - approve_post_count: "The amount of posts from a new user that must be approved" + 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" 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." diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rb index 2054374af25..923315d9150 100644 --- a/lib/new_post_manager.rb +++ b/lib/new_post_manager.rb @@ -71,7 +71,7 @@ class NewPostManager return false if user.staff? || user.staged - (user.trust_level == TrustLevel.levels[:newuser] && user.post_count < SiteSetting.approve_post_count) || + (user.trust_level <= TrustLevel.levels[:basic] && user.post_count < SiteSetting.approve_post_count) || (user.trust_level < SiteSetting.approve_unless_trust_level.to_i) || is_fast_typer?(manager) || matches_auto_block_regex?(manager) diff --git a/spec/components/new_post_manager_spec.rb b/spec/components/new_post_manager_spec.rb index 689ad16054f..955292e7b3a 100644 --- a/spec/components/new_post_manager_spec.rb +++ b/spec/components/new_post_manager_spec.rb @@ -69,7 +69,7 @@ describe NewPostManager do end end - context 'with a high approval post count' do + context 'with a high approval post count and TL0' do before do SiteSetting.approve_post_count = 100 topic.user.trust_level = 0 @@ -81,11 +81,23 @@ describe NewPostManager do end end - context 'with a high approval post count, but TL1' do + context 'with a high approval post count and TL1' do before do SiteSetting.approve_post_count = 100 topic.user.trust_level = 1 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 approval post count, but TL2' do + before do + SiteSetting.approve_post_count = 100 + topic.user.trust_level = 2 + end it "will return an enqueue result" do result = NewPostManager.default_handler(manager) expect(result).to be_nil