From 94e59bbb3fe64c4bf5bb3be87434e04fa728c0b7 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 1 Mar 2024 17:56:01 +0200 Subject: [PATCH] Further improve hacky deduplication algorithm --- portal.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/portal.go b/portal.go index f88c1ea..c539295 100644 --- a/portal.go +++ b/portal.go @@ -1288,7 +1288,11 @@ func (portal *Portal) SyncParticipants(ctx context.Context, source *User, metada var bestParticipant *gmproto.Participant var foundMultiple bool for _, participant := range filteredParticipants { - if participant.GetSomeInt() == 1 && (participant.GetFullName() == metadata.GetName() || participant.GetFormattedNumber() == metadata.GetName()) { + if participant.GetSomeInt() == 1 && + // TODO this name check may be unnecessary (and is even more hacky) + (participant.GetFullName() == metadata.GetName() || + participant.GetFormattedNumber() == metadata.GetName() || + strings.TrimPrefix(participant.GetID().GetNumber(), "+") == strings.TrimPrefix(metadata.GetName(), "+")) { if bestParticipant != nil { foundMultiple = true break