mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06: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]
|
||||
Post.find_by(id: @details[:post_id])
|
||||
else
|
||||
@topic.first_post
|
||||
@topic&.first_post
|
||||
end
|
||||
|
||||
return if post.blank?
|
||||
|
@ -395,6 +395,11 @@ RSpec.describe ComposerMessagesFinder do
|
||||
)
|
||||
expect(finder.check_dont_feed_the_trolls).to be_present
|
||||
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
|
||||
|
||||
describe ".check_get_a_room" do
|
||||
|
Loading…
Reference in New Issue
Block a user