From 072c002198e8a15ae1146aed781c8a1dfe64a64b Mon Sep 17 00:00:00 2001
From: Tulir Asokan <tulir@maunium.net>
Date: Fri, 1 Mar 2024 13:53:46 +0200
Subject: [PATCH] Improve hacky deduplication algorithm

---
 portal.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/portal.go b/portal.go
index b6c9599..f88c1ea 100644
--- a/portal.go
+++ b/portal.go
@@ -1288,7 +1288,7 @@ 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() {
+			if participant.GetSomeInt() == 1 && (participant.GetFullName() == metadata.GetName() || participant.GetFormattedNumber() == metadata.GetName()) {
 				if bestParticipant != nil {
 					foundMultiple = true
 					break