Change sender_id to contact_id in conversations (#167)

* change sender_id to contact_id in conversations

* Fix failing tests

* Fix seeds

* fix specs

* Fix issues in facebook messenger
This commit is contained in:
Sojan Jose
2019-10-21 00:40:18 +05:30
committed by GitHub
parent 2099dc01a6
commit ba8f055802
20 changed files with 294 additions and 309 deletions

View File

@@ -9,16 +9,16 @@ json.data do
json.array! @conversations do |conversation|
json.meta do
json.sender do
json.id conversation.sender_id
json.name conversation.sender.name
json.thumbnail conversation.sender.avatar.thumb.url
json.id conversation.contact.source_id
json.name conversation.contact.name
json.thumbnail conversation.contact.avatar.thumb.url
json.channel conversation.inbox.try(:channel).try(:name)
end
json.assignee conversation.assignee
end
json.id conversation.display_id
if conversation.unread_incoming_messages.count == 0
if conversation.unread_incoming_messages.count.zero?
json.messages [conversation.messages.last.try(:push_event_data)]
else
json.messages conversation.unread_messages.map(&:push_event_data)

View File

@@ -8,8 +8,8 @@ json.data do
json.channel_id inbox.channel_id
json.name inbox.name
json.channel_type inbox.channel_type
json.avatar_url inbox.channel.avatar.url
json.page_id inbox.channel.page_id
json.avatar_url inbox.channel.try(:avatar).try(:url)
json.page_id inbox.channel.try(:page_id)
end
end
end