FIX: Handle nil reply_to_post in AI Bot event handler (#743)

Somehow it's possible to have a nil `post.reply_to_post` with
a non-nil `post.reply_to_post_number`.
This commit is contained in:
Rafael dos Santos Silva 2024-08-07 14:22:32 -03:00 committed by GitHub
parent 1254d7c7d0
commit 3b5245dc54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ module DiscourseAi
mentions = post.mentions.map(&:downcase)
# in case we are replying to a post by a bot
if post.reply_to_post_number && post.reply_to_post.user
if post.reply_to_post_number && post.reply_to_post&.user
mentions << post.reply_to_post.user.username_lower
end