Re-set contact info if phone or contact ID changes

This commit is contained in:
Tulir Asokan 2024-03-01 14:44:29 +02:00
parent 765dc618e6
commit 27d7edcb6d

View file

@ -313,10 +313,12 @@ func (puppet *Puppet) Sync(ctx context.Context, source *User, contact *gmproto.P
update := false update := false
if contact.ID.Number != "" && puppet.Phone != contact.ID.Number { if contact.ID.Number != "" && puppet.Phone != contact.ID.Number {
puppet.Phone = contact.ID.Number puppet.Phone = contact.ID.Number
puppet.ContactInfoSet = false
update = true update = true
} }
if contact.ContactID != puppet.ContactID { if contact.ContactID != puppet.ContactID {
puppet.ContactID = contact.ContactID puppet.ContactID = contact.ContactID
puppet.ContactInfoSet = false
update = true update = true
} }
update = puppet.UpdateName(ctx, contact.GetFormattedNumber(), contact.GetFullName(), contact.GetFirstName()) || update update = puppet.UpdateName(ctx, contact.GetFormattedNumber(), contact.GetFullName(), contact.GetFirstName()) || update