Merge branch 'feat/5913-search-improvements' into feat-new-search-ui

This commit is contained in:
Fayaz Ahmed 2022-12-19 13:52:16 +05:30 committed by GitHub
commit 812c84e2b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ json.payload do
json.array! @result[:conversations] do |conversation|
json.partial! 'api/v1/models/conversation', formats: [:json], conversation: conversation
json.agent do
json.partial! 'api/v1/models/agent', formats: [:json], resource: conversation.assignee if conversation.assignee.present?
json.partial! 'api/v1/models/agent', formats: [:json], resource: conversation.assignee if conversation.try(:assignee).present?
end
end
end
@ -18,10 +18,16 @@ json.payload do
json.array! @result[:messages] do |message|
json.partial! 'api/v1/models/message', formats: [:json], message: message
json.agent do
json.partial! 'api/v1/models/agent', formats: [:json], resource: message.conversation.assignee if message.conversation.assignee.present?
json.partial! 'api/v1/models/agent', formats: [:json], resource: message.conversation.assignee if message.conversation.try(:assignee).present?
end
json.inbox do
json.partial! 'api/v1/models/inbox', formats: [:json], resource: message.inbox if message.inbox.present?
if message.inbox.present?
inbox = message.inbox
json.id inbox.id
json.channel_id inbox.channel_id
json.name inbox.name
json.channel_type inbox.channel_type
end
end
end
end