mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
fix #1567; nil reference in spam_rules_enforcer.rb
This commit is contained in:
parent
c1008f4359
commit
e2a5415aca
@ -76,7 +76,7 @@ class PostCreator
|
|||||||
{ user: @user,
|
{ user: @user,
|
||||||
limit_once_per: 24.hours,
|
limit_once_per: 24.hours,
|
||||||
message_params: {domains: @post.linked_hosts.keys.join(', ')} } )
|
message_params: {domains: @post.linked_hosts.keys.join(', ')} } )
|
||||||
else
|
elsif @post && !@post.errors.present?
|
||||||
SpamRulesEnforcer.enforce!(@post)
|
SpamRulesEnforcer.enforce!(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,6 +44,17 @@ describe PostCreator do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "invalid raw" do
|
||||||
|
|
||||||
|
let(:creator_invalid_raw) { PostCreator.new(user, basic_topic_params.merge(raw: '')) }
|
||||||
|
|
||||||
|
it "has errors" do
|
||||||
|
creator_invalid_raw.create
|
||||||
|
expect(creator_invalid_raw.errors).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
context "success" do
|
context "success" do
|
||||||
|
|
||||||
it "doesn't return true for spam" do
|
it "doesn't return true for spam" do
|
||||||
|
Loading…
Reference in New Issue
Block a user