cache this
This commit is contained in:
@@ -27,13 +27,10 @@ json.meta do
|
||||
end
|
||||
|
||||
json.id conversation.display_id
|
||||
if conversation.messages.where(account_id: conversation.account_id).last.blank?
|
||||
if conversation.cached_last_message.blank?
|
||||
json.messages []
|
||||
else
|
||||
json.messages [
|
||||
conversation.messages.where(account_id: conversation.account_id)
|
||||
.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)
|
||||
]
|
||||
json.messages [conversation.cached_last_message.push_event_data]
|
||||
end
|
||||
|
||||
json.account_id conversation.account_id
|
||||
@@ -54,7 +51,7 @@ json.updated_at conversation.updated_at.to_f
|
||||
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.where(account_id: conversation.account_id).non_activity_messages.first.try(:push_event_data)
|
||||
json.last_non_activity_message conversation.cached_last_non_activity_message&.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