Adjustment: New User Posts must be reviewed at TL0 + TL1

This commit is contained in:
Robin Ward 2016-03-02 14:54:03 -05:00
parent 0167f6bb57
commit be257225b6
3 changed files with 16 additions and 4 deletions

View file

@ -1240,7 +1240,7 @@ en:
emoji_set: "How would you like your emoji?" emoji_set: "How would you like your emoji?"
enforce_square_emoji: "Force a square aspect ratio to all emojis." 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" 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." 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."

View file

@ -71,7 +71,7 @@ class NewPostManager
return false if user.staff? || user.staged 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) || (user.trust_level < SiteSetting.approve_unless_trust_level.to_i) ||
is_fast_typer?(manager) || is_fast_typer?(manager) ||
matches_auto_block_regex?(manager) matches_auto_block_regex?(manager)

View file

@ -69,7 +69,7 @@ describe NewPostManager do
end end
end end
context 'with a high approval post count' do context 'with a high approval post count and TL0' do
before do before do
SiteSetting.approve_post_count = 100 SiteSetting.approve_post_count = 100
topic.user.trust_level = 0 topic.user.trust_level = 0
@ -81,11 +81,23 @@ describe NewPostManager do
end end
end end
context 'with a high approval post count, but TL1' do context 'with a high approval post count and TL1' do
before do before do
SiteSetting.approve_post_count = 100 SiteSetting.approve_post_count = 100
topic.user.trust_level = 1 topic.user.trust_level = 1
end 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 it "will return an enqueue result" do
result = NewPostManager.default_handler(manager) result = NewPostManager.default_handler(manager)
expect(result).to be_nil expect(result).to be_nil