FIX: prevents exception if thread is not found (#21099)

It is yet to investigate the exact reasons leading to this, but probably due to some delete operation or migration, it seems possible to have a message with a thread_id leading to a non existing thread row. This is only a temporary solution to prevent the crash. We should also probably be more defensive here and not include any of this if threading is not enabled.
This commit is contained in:
Joffrey JAFFEUX 2023-04-14 23:03:09 +02:00 committed by GitHub
parent d6b6041ae2
commit ba11cf4767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,7 @@ module Chat
end
def thread_reply_count
object.thread.replies_count
object.thread&.replies_count || 0
end
end
end