mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:21:55 +08:00
FIX: Safely return from missing post on check_dont_feed_the_trolls
(#21238)
This commit is contained in:
parent
4e0c07c56d
commit
96700d55a4
|
@ -233,7 +233,7 @@ class ComposerMessagesFinder
|
||||||
if @details[:post_id]
|
if @details[:post_id]
|
||||||
Post.find_by(id: @details[:post_id])
|
Post.find_by(id: @details[:post_id])
|
||||||
else
|
else
|
||||||
@topic.first_post
|
@topic&.first_post
|
||||||
end
|
end
|
||||||
|
|
||||||
return if post.blank?
|
return if post.blank?
|
||||||
|
|
|
@ -395,6 +395,11 @@ RSpec.describe ComposerMessagesFinder do
|
||||||
)
|
)
|
||||||
expect(finder.check_dont_feed_the_trolls).to be_present
|
expect(finder.check_dont_feed_the_trolls).to be_present
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "safely returns from not finding a post" do
|
||||||
|
finder = ComposerMessagesFinder.new(user, composer_action: "reply", topic_id: nil)
|
||||||
|
expect(finder.check_dont_feed_the_trolls).to be_blank
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".check_get_a_room" do
|
describe ".check_get_a_room" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user