Skip to content

Commit

Permalink
Adjustment: New User Posts must be reviewed at TL0 + TL1
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Mar 2, 2016
1 parent 0167f6b commit be25722
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/locales/server.en.yml
Expand Up @@ -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."

Expand Down
2 changes: 1 addition & 1 deletion lib/new_post_manager.rb
Expand Up @@ -71,7 +71,7 @@ def self.user_needs_approval?(manager)

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)
Expand Down
16 changes: 14 additions & 2 deletions spec/components/new_post_manager_spec.rb
Expand Up @@ -69,7 +69,7 @@
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
Expand All @@ -81,11 +81,23 @@
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
Expand Down

0 comments on commit be25722

Please sign in to comment.