mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
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:
parent
d16de4a0a1
commit
ca393bcc53
4 changed files with 50 additions and 8 deletions
|
@ -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'}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue