discourse/plugins
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
..
chat FIX: nil exception in chat notifier (#21105) 2023-04-18 19:57:56 +04:00
discourse-details Update translations (#21055) 2023-04-11 15:45:03 +02:00
discourse-lazy-videos FIX: Add missing translations strings for lazy-videos (#21127) 2023-04-18 07:01:27 -03:00
discourse-local-dates DEV: Support `@debounce` decorator in native class syntax (#20521) 2023-03-03 11:48:58 +00:00
discourse-narrative-bot FIX: Render links with subfolders properly in Discobot 2023-04-17 16:53:00 +02:00
discourse-presence Update translations (#20370) 2023-02-20 11:01:01 +01:00
poll UX: Vertical alignment issues on mobile (#21118) 2023-04-17 22:51:13 +05:30
styleguide Update translations (#20861) 2023-04-05 09:12:48 +02:00