From b46ee5e580123550957465de270dc5f096350a86 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Fri, 3 Dec 2021 22:45:00 +0530 Subject: [PATCH] Fix: Conversation status event in widget side (#3509) --- app/listeners/action_cable_listener.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/listeners/action_cable_listener.rb b/app/listeners/action_cable_listener.rb index a81c74976..4edf62f50 100644 --- a/app/listeners/action_cable_listener.rb +++ b/app/listeners/action_cable_listener.rb @@ -34,7 +34,7 @@ class ActionCableListener < BaseListener def conversation_status_changed(event) conversation, account = extract_conversation_and_account(event) - tokens = user_tokens(account, conversation.inbox.members) + [conversation.contact&.pubsub_token] + tokens = user_tokens(account, conversation.inbox.members) + contact_inbox_tokens(conversation.contact_inbox) broadcast(account, tokens, CONVERSATION_STATUS_CHANGED, conversation.push_event_data) end @@ -137,6 +137,10 @@ class ActionCableListener < BaseListener return [] if message.activity? return [] if contact_inbox.nil? + contact_inbox_tokens(contact_inbox) + end + + def contact_inbox_tokens(contact_inbox) contact = contact_inbox.contact contact_inbox.hmac_verified? ? contact.contact_inboxes.where(hmac_verified: true).filter_map(&:pubsub_token) : [contact_inbox.pubsub_token]