chore: Improve email parsing using email trimmer gem (#3611)
Email parsing using email_trimmer gem Fixes: #3539 , #2954, #3572
This commit is contained in:
@@ -7,6 +7,7 @@ RSpec.describe ReplyMailbox, type: :mailbox do
|
||||
let(:account) { create(:account) }
|
||||
let(:agent) { create(:user, email: 'agent1@example.com', account: account) }
|
||||
let(:reply_mail) { create_inbound_email_from_fixture('reply.eml') }
|
||||
let(:mail_with_quote) { create_inbound_email_from_fixture('mail_with_quote.eml') }
|
||||
let(:conversation) { create(:conversation, assignee: agent, inbox: create(:inbox, account: account, greeting_enabled: false), account: account) }
|
||||
let(:described_subject) { described_class.receive reply_mail }
|
||||
let(:serialized_attributes) do
|
||||
@@ -95,5 +96,35 @@ RSpec.describe ReplyMailbox, type: :mailbox do
|
||||
expect(conversation_1.messages.last.content).to eq("Let's talk about these images:")
|
||||
end
|
||||
end
|
||||
|
||||
context 'with quotes in email' do
|
||||
let(:described_subject) { described_class.receive mail_with_quote }
|
||||
|
||||
before do
|
||||
# this UUID is hardcoded in the reply.eml, that's why we are updating this
|
||||
conversation.uuid = '6bdc3f4d-0bec-4515-a284-5d916fdde489'
|
||||
conversation.save
|
||||
end
|
||||
|
||||
it 'add the mail content as new message on the conversation' do
|
||||
described_subject
|
||||
expect(conversation.messages.last.content).to eq(
|
||||
<<-BODY.strip_heredoc.chomp
|
||||
Yes, I am providing you step how to reproduce this issue
|
||||
|
||||
On Thu, Aug 19, 2021 at 2:07 PM Tejaswini from Email sender test < tejaswini@chatwoot.com> wrote:
|
||||
|
||||
> Any update on this?
|
||||
>
|
||||
>
|
||||
|
||||
--
|
||||
* Sony Mathew*
|
||||
Software developer
|
||||
*Mob:9999999999
|
||||
BODY
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user