iachat/app/builders
Pranav b5deac468e
fix: Fix duplicate contact inbox race condition (#11139)
This PR addresses a race condition in the contact inbox model caused by
duplicate `source_id` values linked to different contacts.

The issue typically occurs when an agent updates a contact’s email or
phone number or when two contacts are merged. In these scenarios, the
`source_id`, which is intended to uniquely identify the contact in a
session, may still be associated with the old contact inbox.

To solve this, we check if there’s already a ContactInbox with the same
source_id but linked to another contact. If we find one, we update that
old record by changing its source_id to a random value. This breaks the
wrong connection and prevents issues, while still keeping the old data
safe.

However, this is only a temporary fix. The main issue is with the way
the contact inbox model is designed. Right now, it’s being used to track
sessions, but that may not be necessary for non-live chat channels. In
the long run, we should consider redesigning this part of the system to
avoid such problems.
2025-03-20 18:24:28 -07:00
..
campaigns chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
csat_surveys feat: Add CSAT response APIs (#2503) 2021-06-29 20:59:41 +05:30
messages feat: Render instagram reels in Chatwoot (#9829) 2024-07-24 12:58:12 -07:00
v2 feat(v4): Update the report pages to show aggregate values (#10766) 2025-01-28 09:19:18 +05:30
account_builder.rb fix: default return in blocked domains (#10046) 2024-08-29 15:36:57 +05:30
agent_builder.rb fix: Avoid duplicate invitation emails when adding an agent (#9131) 2024-03-26 18:58:45 -07:00
contact_inbox_builder.rb fix: Fix duplicate contact inbox race condition (#11139) 2025-03-20 18:24:28 -07:00
contact_inbox_with_contact_builder.rb fix: Profile pictures missing in facebook inbox [CW-1976] (#9212) 2024-05-08 20:38:16 -07:00
conversation_builder.rb feat: Ability to lock to single conversation (#5881) 2022-11-25 13:01:04 +03:00
notification_builder.rb fix: Exclude notifications for blocked contacts, except mentions (#10659) 2025-01-12 15:30:27 +05:30
notification_subscription_builder.rb chore: Use "create!" and "save!" bang methods when not checking the result (#5358) 2022-09-13 17:40:06 +05:30