fix: undefined method contact in support mailbox (#2678)
if chatwoot receives an email of already existing contact with a different case say "Care@example.com", before this fix, it will throw an error. Now it will retrieve existing contact Fixes: #2553 Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -66,6 +66,20 @@ describe ::ContactBuilder do
|
||||
expect(contact_inbox.contact.id).to be(contact.id)
|
||||
end
|
||||
|
||||
it 'doesnot create contact when an uppercase email is passed for an already existing contact email' do
|
||||
contact_inbox = described_class.new(
|
||||
source_id: '123456',
|
||||
inbox: inbox,
|
||||
contact_attributes: {
|
||||
name: 'Contact',
|
||||
phone_number: '+1234567890',
|
||||
email: contact.email.upcase
|
||||
}
|
||||
).perform
|
||||
|
||||
expect(contact_inbox.contact.id).to be(contact.id)
|
||||
end
|
||||
|
||||
it 'doesnot create contact if it already exist with phone number' do
|
||||
contact_inbox = described_class.new(
|
||||
source_id: '123456',
|
||||
|
||||
Reference in New Issue
Block a user