parent
0c3e8b6dbd
commit
6ad5a7452c
4 changed files with 13 additions and 3 deletions
|
@ -22,7 +22,7 @@ class ApplicationMailbox < ActionMailbox::Base
|
|||
proc do |inbound_mail_obj|
|
||||
is_a_support_email = false
|
||||
inbound_mail_obj.mail.to&.each do |email|
|
||||
channel = Channel::Email.find_by('email = ? OR forward_to_email = ?', email, email)
|
||||
channel = Channel::Email.find_by('lower(email) = ? OR lower(forward_to_email) = ?', email.downcase, email.downcase)
|
||||
if channel.present?
|
||||
is_a_support_email = true
|
||||
break
|
||||
|
|
|
@ -21,7 +21,7 @@ class SupportMailbox < ApplicationMailbox
|
|||
|
||||
def find_channel
|
||||
mail.to.each do |email|
|
||||
@channel = Channel::Email.find_by('email = ? OR forward_to_email = ?', email, email)
|
||||
@channel = Channel::Email.find_by('lower(email) = ? OR lower(forward_to_email) = ?', email.downcase, email.downcase)
|
||||
break if @channel.present?
|
||||
end
|
||||
raise 'Email channel/inbox not found' if @channel.nil?
|
||||
|
|
|
@ -4,7 +4,7 @@ Content-Type: multipart/alternative; boundary="Apple-Mail=_33A037C7-4BB3-4772-AE
|
|||
Subject: Discussion: Let's debate these attachments
|
||||
Date: Tue, 20 Apr 2020 04:20:20 -0400
|
||||
In-Reply-To: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>
|
||||
To: "Replies" <care@example.com>
|
||||
To: "Replies" <Care@example.com>
|
||||
References: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>
|
||||
Message-Id: <0CB459E0-0336-41DA-BC88-E6E28C697DDB@chatwoot.com>
|
||||
X-Mailer: Apple Mail (2.1244.3)
|
||||
|
|
|
@ -66,6 +66,16 @@ RSpec.describe SupportMailbox, type: :mailbox do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'Sender with upcase mail address' do
|
||||
let(:support_mail_without_sender_name) { create_inbound_email_from_fixture('support_without_sender_name.eml') }
|
||||
let(:described_subject) { described_class.receive support_mail_without_sender_name }
|
||||
|
||||
it 'create a new inbox with the email case insensitive' do
|
||||
described_subject
|
||||
expect(conversation.inbox.id).to eq(channel_email.inbox.id)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'handle inbox contacts' do
|
||||
let(:contact) { create(:contact, account: account, email: support_mail.mail.from.first) }
|
||||
let(:contact_inbox) { create(:contact_inbox, inbox: channel_email.inbox, contact: contact) }
|
||||
|
|
Loading…
Reference in a new issue