feat: API to list all attachments for a conversation (#7059)
Fixes: https://linear.app/chatwoot/issue/CW-1678/api-to-list-all-attachments-for-a-conversation
This commit is contained in:
@@ -20,6 +20,13 @@ FactoryBot.define do
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_attachment do
|
||||
after(:build) do |message|
|
||||
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)
|
||||
attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png')
|
||||
end
|
||||
end
|
||||
|
||||
after(:build) do |message|
|
||||
message.sender ||= message.outgoing? ? create(:user, account: message.account) : create(:contact, account: message.account)
|
||||
message.inbox ||= message.conversation&.inbox || create(:inbox, account: message.account)
|
||||
|
||||
Reference in New Issue
Block a user