FIX: Have the `approve post count` setting work as advertised

This commit is contained in:
Robin Ward 2016-03-02 13:20:13 -05:00
parent f32f0d6337
commit 94f5aa6015
2 changed files with 13 additions and 1 deletions

View File

@ -71,7 +71,7 @@ class NewPostManager
return false if user.staff? || user.staged return false if user.staff? || user.staged
(user.post_count < SiteSetting.approve_post_count) || (user.trust_level == TrustLevel.levels[:newuser] && 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

@ -72,6 +72,7 @@ describe NewPostManager do
context 'with a high approval post count' do context 'with a high approval post count' do
before do before do
SiteSetting.approve_post_count = 100 SiteSetting.approve_post_count = 100
topic.user.trust_level = 0
end 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)
@ -80,6 +81,17 @@ describe NewPostManager do
end end
end end
context 'with a high approval post count, but 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(result).to be_nil
end
end
context 'with a high trust level setting' do context 'with a high trust level setting' do
before do before do
SiteSetting.approve_unless_trust_level = 4 SiteSetting.approve_unless_trust_level = 4