diff --git a/app/javascript/widget/components/ChatMessage.vue b/app/javascript/widget/components/ChatMessage.vue
index aba16467b..f80933b83 100755
--- a/app/javascript/widget/components/ChatMessage.vue
+++ b/app/javascript/widget/components/ChatMessage.vue
@@ -1,10 +1,6 @@
-
+
diff --git a/app/listeners/action_cable_listener.rb b/app/listeners/action_cable_listener.rb
index d229ae2c4..de0aab116 100644
--- a/app/listeners/action_cable_listener.rb
+++ b/app/listeners/action_cable_listener.rb
@@ -19,7 +19,7 @@ class ActionCableListener < BaseListener
contact = conversation.contact
members = conversation.inbox.members.pluck(:pubsub_token)
send_to_members(members, MESSAGE_CREATED, message.push_event_data)
- send_to_contact(contact, MESSAGE_CREATED, message.push_event_data)
+ send_to_contact(contact, MESSAGE_CREATED, message)
end
def conversation_reopened(event)
@@ -50,10 +50,12 @@ class ActionCableListener < BaseListener
end
end
- def send_to_contact(contact, event_name, data)
+ def send_to_contact(contact, event_name, message)
+ return if message.private?
+ return if message.activity?
return if contact.nil?
- ActionCable.server.broadcast(contact.pubsub_token, event: event_name, data: data)
+ ActionCable.server.broadcast(contact.pubsub_token, event: event_name, data: message.push_event_data)
end
def push(pubsub_token, data)
diff --git a/app/views/api/v1/widget/messages/index.json.jbuilder b/app/views/api/v1/widget/messages/index.json.jbuilder
index 5cedfc570..57bab734c 100644
--- a/app/views/api/v1/widget/messages/index.json.jbuilder
+++ b/app/views/api/v1/widget/messages/index.json.jbuilder
@@ -5,5 +5,5 @@ json.array! @messages do |message|
json.created_at message.created_at.to_i
json.conversation_id message. conversation_id
json.attachment message.attachment.push_event_data if message.attachment
- json.sender_name message.user.name if message.user
+ json.sender message.user.push_event_data if message.user
end
diff --git a/config/database.yml b/config/database.yml
index 98cc398a4..e60358062 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -6,9 +6,9 @@ default: &default
development:
<<: *default
- database: chatwoot_dev
- username: postgres
- password:
+ database: <%= ENV.fetch('POSTGRES_DATABASE', 'chatwoot_dev') %>
+ username: <%= ENV.fetch('POSTGRES_USERNAME', 'postgres') %>
+ password: <%= ENV.fetch('POSTGRES_PASSWORD', '') %>
test:
<<: *default