mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-10 22:25:39 +00:00
adf6aa4270
Two contact resolution fixes in create conversation: Under the reuse policy, an unknown external_user_id went straight to insert. If the email belonged to an existing contact, that inserted a duplicate contact sharing the email, since the unique email index only covers rows without an ext_id. The ext_id lookup now falls back to the email match before inserting. Regression test added. The new conversation form sends name fields as a snapshot from contact search, so a contacts:write agent submitting the form could overwrite a contact that was renamed after the search. The form now sends reuse_contact: true and the backend downgrades to the reuse policy when it is set. API callers like an external CRM omit the flag and keep the full sync/upsert behavior. The flag can only downgrade, never escalate. Also from review: hoist the repeated password generation block into newContactPassword, drop testutil.NewLogger and the duplicate newTestI18n in transcript_test.go in favor of testutil.NewI18n, and clean up stale comments.