mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-29 16:39:35 +00:00
SyncInbound (invoked from UpdateInboundClient during a client edit) looks up the ClientRecord row by the email present in the inbound's settings. After an email change the lookup misses the original row, hits the gorm.ErrRecordNotFound branch, and inserts a fresh ClientRecord with the new email. The original row stays in place with its inbound link cleared, so the clients list shows both — the original as an orphan and the new one as if it had just been created. Rename the existing ClientRecord row to the new email up front, before the inbound loop runs. SyncInbound then finds and updates the same row instead of creating a duplicate. A pre-check rejects renames that would collide with another client's email so the unique index keeps its meaning.