FEATURE: min_first_post_typing_time

If a user spends less than 3 seconds typing
first post they will automatically enter the approval queue
This commit is contained in:
Sam
2015-08-04 10:55:59 +10:00
parent a2533e2a02
commit 01ad88f1ed
5 changed files with 33 additions and 4 deletions

View File

@ -446,6 +446,10 @@ describe PostsController do
describe 'creating a post' do
before do
SiteSetting.min_first_post_typing_time = 0
end
include_examples 'action requires login', :post, :create
context 'api' do
@ -477,6 +481,19 @@ describe PostsController do
expect { xhr :post, :create }.to raise_error(ActionController::ParameterMissing)
end
it 'queues the post if min_first_post_typing_time is not met' do
SiteSetting.min_first_post_typing_time = 3000
xhr :post, :create, {raw: 'this is the test content', title: 'this is the test title for the topic'}
expect(response).to be_success
parsed = ::JSON.parse(response.body)
expect(parsed["action"]).to eq("enqueued")
end
it 'creates the post' do
xhr :post, :create, {raw: 'this is the test content', title: 'this is the test title for the topic'}