Fix ActionCable broadcast and LeadSquared setup

This commit is contained in:
Sojan Jose
2026-01-16 00:11:39 -08:00
parent be752af4c5
commit 1748c668cf
3 changed files with 16 additions and 5 deletions
+11 -3
View File
@@ -25,9 +25,17 @@ class ActionCableBroadcastJob < ApplicationJob
def prepare_broadcast_data(event_name, data)
return data unless CONVERSATION_UPDATE_EVENTS.include?(event_name)
account = Account.find(data[:account_id])
conversation = account.conversations.find_by!(display_id: data[:id])
conversation.push_event_data.merge(account_id: data[:account_id])
account_id = data[:account_id]
display_id = data[:id]
return data if account_id.blank? || display_id.blank?
account = Account.find_by(id: account_id)
return data if account.blank?
conversation = account.conversations.find_by(display_id: display_id)
return data if conversation.blank?
conversation.push_event_data.merge(account_id: account_id)
end
def broadcast_to_members(members, event_name, broadcast_data)
+4 -1
View File
@@ -89,7 +89,10 @@ class Integrations::Hook < ApplicationRecord
end
def ensure_hook_type
self.hook_type = app.params[:hook_type] if app.present?
return if app.blank?
return unless new_record? || hook_type.blank?
self.hook_type = app.params[:hook_type]
end
def validate_settings_json_schema
@@ -82,7 +82,7 @@ class Crm::Leadsquared::SetupService
end
def update_hook_settings(params)
@hook.settings = @hook.settings.merge(params)
@hook.settings = @hook.settings.merge(params.stringify_keys)
@hook.save!
end