2020-03-05 20:17:37 +00:00
|
|
|
json.meta do
|
|
|
|
json.sender do
|
2020-07-04 14:16:17 +00:00
|
|
|
json.partial! 'api/v1/models/contact.json.jbuilder', resource: conversation.contact
|
2020-03-05 20:17:37 +00:00
|
|
|
end
|
2020-07-04 14:16:17 +00:00
|
|
|
json.channel conversation.inbox.try(:channel_type)
|
2020-07-27 16:49:26 +00:00
|
|
|
if conversation.assignee
|
|
|
|
json.assignee do
|
|
|
|
json.partial! 'api/v1/models/user.json.jbuilder', resource: conversation.assignee
|
|
|
|
end
|
|
|
|
end
|
2020-03-05 20:17:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
json.id conversation.display_id
|
|
|
|
if conversation.unread_incoming_messages.count.zero?
|
|
|
|
json.messages [conversation.messages.last.try(:push_event_data)]
|
|
|
|
else
|
2020-06-25 18:05:16 +00:00
|
|
|
json.messages conversation.unread_messages.includes([:user, :attachments]).map(&:push_event_data)
|
2020-03-05 20:17:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
json.inbox_id conversation.inbox_id
|
|
|
|
json.status conversation.status
|
2020-05-26 12:13:59 +00:00
|
|
|
json.muted conversation.muted?
|
2020-07-25 17:24:45 +00:00
|
|
|
json.can_reply conversation.can_reply?
|
2020-03-05 20:17:37 +00:00
|
|
|
json.timestamp conversation.messages.last.try(:created_at).try(:to_i)
|
2020-09-10 13:49:15 +00:00
|
|
|
json.contact_last_seen_at conversation.contact_last_seen_at.to_i
|
2020-03-05 20:17:37 +00:00
|
|
|
json.agent_last_seen_at conversation.agent_last_seen_at.to_i
|
|
|
|
json.unread_count conversation.unread_incoming_messages.count
|
|
|
|
json.additional_attributes conversation.additional_attributes
|
2020-04-10 11:12:37 +00:00
|
|
|
json.account_id conversation.account_id
|
2020-06-25 15:34:03 +00:00
|
|
|
json.labels conversation.label_list
|