FEATURE: optional regex to be applied against first posts

for spam prevention you can add a regex to auto_block_first_post_regex
this will be applied against all first posts, if it matches post will go
into the approval queue and user will be blocked
This commit is contained in:
Sam
2015-08-05 13:08:21 +10:00
parent d16de4a0a1
commit ca393bcc53
4 changed files with 50 additions and 8 deletions

View File

@ -505,6 +505,20 @@ describe PostsController do
end
it 'blocks correctly based on auto_block_first_post_regex' do
SiteSetting.auto_block_first_post_regex = "I love candy|i eat s[1-5]"
xhr :post, :create, {raw: 'this is the test content', title: 'when I eat s3 sometimes when not looking'}
expect(response).to be_success
parsed = ::JSON.parse(response.body)
expect(parsed["action"]).to eq("enqueued")
user.reload
expect(user.blocked).to eq(true)
end
it 'creates the post' do
xhr :post, :create, {raw: 'this is the test content', title: 'this is the test title for the topic'}