added tests and enabled queue when new setting is > 0
This commit is contained in:
parent
5dbb3035d4
commit
0344388924
|
@ -115,6 +115,7 @@ class NewPostManager
|
||||||
def self.queue_enabled?
|
def self.queue_enabled?
|
||||||
SiteSetting.approve_post_count > 0 ||
|
SiteSetting.approve_post_count > 0 ||
|
||||||
SiteSetting.approve_unless_trust_level.to_i > 0 ||
|
SiteSetting.approve_unless_trust_level.to_i > 0 ||
|
||||||
|
SiteSetting.approve_new_topics_unless_trust_level.to_i > 0 ||
|
||||||
handlers.size > 1
|
handlers.size > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,31 @@ describe NewPostManager do
|
||||||
end
|
end
|
||||||
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
|
||||||
|
end
|
||||||
|
it "doesn't return a result action" do
|
||||||
|
result = NewPostManager.default_handler(manager)
|
||||||
|
expect(result).to eq(nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context "new topic handler" do
|
||||||
|
let(:manager) { NewPostManager.new(topic.user, raw: 'this is new topic content', title: 'new topic title') }
|
||||||
|
context 'with a high trust level setting for new topics' do
|
||||||
|
before do
|
||||||
|
SiteSetting.approve_new_topics_unless_trust_level = 4
|
||||||
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "extensibility priority" do
|
context "extensibility priority" do
|
||||||
|
|
Loading…
Reference in New Issue