mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
fix: Force account_id in message filters (#7705)
This commit is contained in:
@@ -170,7 +170,7 @@ class Conversation < ApplicationRecord
|
||||
end
|
||||
|
||||
def unread_incoming_messages
|
||||
unread_messages.incoming.last(10)
|
||||
unread_messages.where(account_id: account_id).incoming.last(10)
|
||||
end
|
||||
|
||||
def push_event_data
|
||||
|
||||
@@ -20,7 +20,10 @@ json.id conversation.display_id
|
||||
if conversation.messages.first.blank?
|
||||
json.messages []
|
||||
else
|
||||
json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)]
|
||||
json.messages [
|
||||
conversation.messages.where(account_id: conversation.account_id)
|
||||
.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)
|
||||
]
|
||||
end
|
||||
|
||||
json.account_id conversation.account_id
|
||||
@@ -40,7 +43,7 @@ json.created_at conversation.created_at.to_i
|
||||
json.timestamp conversation.last_activity_at.to_i
|
||||
json.first_reply_created_at conversation.first_reply_created_at.to_i
|
||||
json.unread_count conversation.unread_incoming_messages.count
|
||||
json.last_non_activity_message conversation.messages.non_activity_messages.first.try(:push_event_data)
|
||||
json.last_non_activity_message conversation.messages.where(account_id: conversation.account_id).non_activity_messages.first.try(:push_event_data)
|
||||
json.last_activity_at conversation.last_activity_at.to_i
|
||||
json.priority conversation.priority
|
||||
json.waiting_since conversation.waiting_since.to_i.to_i
|
||||
|
||||
Reference in New Issue
Block a user