Fix: Conversation status event in widget side (#3509)

This commit is contained in:
Muhsin Keloth 2021-12-03 22:45:00 +05:30 committed by GitHub
parent 6d378eb206
commit b46ee5e580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]