chore: Add more conversation events for reload (#10877)

Followup PR for https://github.com/chatwoot/chatwoot/pull/10876. This PR
just adds all the events related to conversation update to be reloaded
before sending it to the UI.
This commit is contained in:
Pranav
2025-02-11 00:33:45 -08:00
committed by GitHub
parent 3c78d25306
commit 4b12a8a51e

View File

@@ -1,5 +1,14 @@
class ActionCableBroadcastJob < ApplicationJob
queue_as :critical
include Events::Types
CONVERSATION_UPDATE_EVENTS = [
CONVERSATION_READ,
CONVERSATION_UPDATED,
TEAM_CHANGED,
ASSIGNEE_CHANGED,
CONVERSATION_STATUS_CHANGED
].freeze
def perform(members, event_name, data)
return if members.blank?
@@ -14,7 +23,7 @@ class ActionCableBroadcastJob < ApplicationJob
# caused by out-of-order events during high-traffic periods. This prevents
# the conversation job from processing outdated data.
def prepare_broadcast_data(event_name, data)
return data unless event_name == 'conversation.updated'
return data unless CONVERSATION_UPDATE_EVENTS.include?(event_name)
account = Account.find(data[:account_id])
conversation = account.conversations.find_by!(display_id: data[:id])