discourse/plugins/chat
Andrei Prigorshnev 26543a5b59
FIX: nil exception in chat notifier (#21105)
We've found these exceptions in logs:

    Job exception: undefined method `destroy!' for nil:NilClass
    
    /var/www/discourse/plugins/chat/lib/chat/notifier.rb:102:in `block in notify_edit' 
    /var/www/discourse/plugins/chat/lib/chat/notifier.rb💯in `each' 
    /var/www/discourse/plugins/chat/lib/chat/notifier.rb💯in `notify_edit' 
    /var/www/discourse/plugins/chat/app/jobs/regular/chat/send_message_notifications.rb:18:in `execute' 

In the past, we were creating `chat_mention` records only for sending notifications, so every mention record had a related notification. It isn't the case anymore (since fa543cda). This PR fixes the problem by making sure the notification exists before trying to remove it. Also, we shouldn't be deleting a `chat_mention` record itself, only a notification, this PR fixes that too.

It's quite hard to reproduce this bug locally, I wasn't able to do so, the logic in this class is quite complicated, that's why I'm not adding a test. Also, when looking at this I realized that this method isn't in a fully correct state now, I suspect sometimes some notifications may not be delivered after someone edits a chat message and adds new mentions to it. I'm going to refactor and simplify the method in a subsequent PR.
2023-04-18 19:57:56 +04:00
..
app FEATURE: Better thread reply counter cache (#21108) 2023-04-18 14:01:01 +10:00
assets FIX: apply clear-transition class to correct wrapper for chat drawer (#21129) 2023-04-18 08:37:13 +02:00
config FEATURE: Better thread reply counter cache (#21108) 2023-04-18 14:01:01 +10:00
db DEV: Chat thread reply counter cache (#21050) 2023-04-11 15:40:25 +10:00
lib FIX: nil exception in chat notifier (#21105) 2023-04-18 19:57:56 +04:00
public
spec FEATURE: Better thread reply counter cache (#21108) 2023-04-18 14:01:01 +10:00
test/javascripts FIX: relies on native focus behavior in chat emoji picker (#21092) 2023-04-13 20:35:13 +02:00
plugin.rb FEATURE: Auto-remove users without permission from channel (#20344) 2023-03-22 10:19:59 +10:00
README.md DEV: Chat service object initial implementation (#19814) 2023-02-13 13:09:57 +01:00

This plugin is still in active development and may change frequently

Documentation

The Discourse Chat plugin adds chat functionality to your Discourse so it can natively support both long-form and short-form communication needs of your online community.

For user documentation, see Discourse Chat.

For developer documentation, see Discourse Documentation.