Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation
This commit is contained in:
@@ -77,7 +77,7 @@ class MailPresenter < SimpleDelegator
|
||||
mail.attachments.map do |attachment|
|
||||
blob = ActiveStorage::Blob.create_and_upload!(
|
||||
io: StringIO.new(attachment.body.to_s),
|
||||
filename: attachment.filename,
|
||||
filename: attachment.filename.presence || "attachment_#{SecureRandom.hex(4)}",
|
||||
content_type: attachment.content_type
|
||||
)
|
||||
{ original: attachment, blob: blob }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class Line::IncomingMessageService
|
||||
include ::FileTypeHelper
|
||||
pattr_initialize [:inbox!, :params!]
|
||||
LINE_STICKER_IMAGE_URL = 'https://stickershop.line-scdn.net/stickershop/v1/sticker/%s/iphone/sticker.png'.freeze
|
||||
LINE_STICKER_IMAGE_URL = 'https://stickershop.line-scdn.net/stickershop/v1/sticker/%s/android/sticker.png'.freeze
|
||||
|
||||
def perform
|
||||
# probably test events
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From: test@gmail.com
|
||||
Date: Thu, 4 May 2023 10:35:52 +0530
|
||||
Message-ID: <6215d536e0484_10bc6191402183@tejaswinis-MacBook-Pro.local.mail>
|
||||
Subject: multiple attachments
|
||||
To: test@outlook.com
|
||||
Content-Type: multipart/mixed; boundary="0000000000002488f405fad721cc"
|
||||
|
||||
--0000000000002488f405fad721cc
|
||||
Content-Type: multipart/alternative; boundary="0000000000002488f205fad721ca"
|
||||
|
||||
--0000000000002488f205fad721ca
|
||||
Content-Type: text/plain; charset="UTF-8"
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Hi people!
|
||||
|
||||
We are excited to inform you that we have recently released some new
|
||||
features and several updates to our platform. These features and updates
|
||||
are designed to enhance your experience and make your trading journey
|
||||
seamless and efficient.
|
||||
|
||||
|
||||
|
||||
> Okay noted
|
||||
|
||||
|
||||
--0000000000002488f205fad721ca--
|
||||
--0000000000002488f405fad721cc
|
||||
Content-Type: image/png; name=""
|
||||
Content-Disposition: attachment; filename=""
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <f_lh8nwk8l3>
|
||||
X-Attachment-Id: f_lh8nwk8l3
|
||||
|
||||
|
||||
--0000000000002488f405fad721cc
|
||||
Content-Type: image/png; name=""
|
||||
Content-Disposition: attachment; filename=""
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-ID: <f_lh8nwk8l2>
|
||||
X-Attachment-Id: f_lh8nwk8l2
|
||||
|
||||
|
||||
--0000000000002488f405fad721cc--
|
||||
@@ -43,6 +43,22 @@ RSpec.describe Imap::ImapMailbox do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the email has attachments with no filename' do
|
||||
let(:inbound_mail) { create_inbound_email_from_fixture('attachments_without_filename.eml') }
|
||||
|
||||
it 'creates a conversation and a message with properly named attachments' do
|
||||
expect do
|
||||
class_instance.process(inbound_mail.mail, channel)
|
||||
end.to change(Conversation, :count).by(1)
|
||||
|
||||
last_message = conversation.messages.last
|
||||
expect(last_message.attachments.count).to be 2
|
||||
|
||||
filenames = last_message.attachments.map(&:file).map { |file| file.blob.filename.to_s }
|
||||
expect(filenames.all? { |filename| filename.present? && filename.start_with?('attachment_') }).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the email has 15 or more attachments' do
|
||||
let(:inbound_mail) { create_inbound_email_from_fixture('multiple_attachments.eml') }
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ describe Line::IncomingMessageService do
|
||||
described_class.new(inbox: line_channel.inbox, params: sticker_params).perform
|
||||
expect(line_channel.inbox.conversations).not_to eq(0)
|
||||
expect(Contact.all.first.name).to eq('LINE Test')
|
||||
expect(line_channel.inbox.messages.first.content).to eq('')
|
||||
expect(line_channel.inbox.messages.first.content).to eq('')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user