chore: Add a check to verify if the user exists before broadcasting the notification_deleted event. (#8678)
When a user is deleted, all associated notifications are also deleted from the database. As a result, the user record becomes empty. handling this case in code to prevent sentry errors.
This commit is contained in:
@@ -8,6 +8,8 @@ class ActionCableListener < BaseListener
|
||||
end
|
||||
|
||||
def notification_deleted(event)
|
||||
return if event.data[:notification].user.blank?
|
||||
|
||||
notification, account, unread_count, count = extract_notification_and_account(event)
|
||||
tokens = [event.data[:notification].user.pubsub_token]
|
||||
broadcast(account, tokens, NOTIFICATION_DELETED, { notification: notification.push_event_data, unread_count: unread_count, count: count })
|
||||
|
||||
Reference in New Issue
Block a user