fix: Adds condition to handle base and mergee contact being same (#2485)
When an agent updates a contact email in the dashboard and the contact also update his email via the email collect box, Merge action receives the same base and mergee contacts which could cause data corruption.
This commit is contained in:
@@ -2,6 +2,10 @@ class ContactMergeAction
|
||||
pattr_initialize [:account!, :base_contact!, :mergee_contact!]
|
||||
|
||||
def perform
|
||||
# This case happens when an agent updates a contact email in dashboard,
|
||||
# while the contact also update his email via email collect box
|
||||
return @base_contact if base_contact.id == mergee_contact.id
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
validate_contacts
|
||||
merge_conversations
|
||||
|
||||
Reference in New Issue
Block a user