2020-08-06 09:51:06 +00:00
|
|
|
class ConversationDrop < BaseDrop
|
2021-11-17 12:35:53 +00:00
|
|
|
include MessageFormatHelper
|
|
|
|
|
2020-08-06 09:51:06 +00:00
|
|
|
def display_id
|
|
|
|
@obj.try(:display_id)
|
|
|
|
end
|
2021-11-17 12:35:53 +00:00
|
|
|
|
|
|
|
def recent_messages
|
|
|
|
@obj.try(:recent_messages).map do |message|
|
|
|
|
{
|
|
|
|
'sender' => message.sender&.available_name || message.sender&.name,
|
|
|
|
'content' => transform_user_mention_content(message.content),
|
|
|
|
'attachments' => message.attachments.map(&:file_url)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2020-08-06 09:51:06 +00:00
|
|
|
end
|