Skip to content

Commit

Permalink
fix: Remove unnecessary attributes from notification deleted action c…
Browse files Browse the repository at this point in the history
…able event payload (chatwoot#9295)

fix: simplify notification deleted payload event
  • Loading branch information
muhsin-k authored Apr 25, 2024
1 parent 9086650 commit 1bf3ad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/listeners/action_cable_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def notification_deleted(event)

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 })
broadcast(account, tokens, NOTIFICATION_DELETED, { notification: { id: notification.id }, unread_count: unread_count, count: count })
end

def account_cache_invalidated(event)
Expand Down
4 changes: 3 additions & 1 deletion spec/listeners/action_cable_listener_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@
'notification.deleted',
{
account_id: notification.account_id,
notification: notification.push_event_data,
notification: {
id: notification.id
},
unread_count: 1,
count: 1
}
Expand Down

0 comments on commit 1bf3ad9

Please sign in to comment.