From 623b61b3c2a28ac501dbd5f1d75d92682c566f62 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 15 Nov 2021 10:26:12 +0000 Subject: [PATCH] Update check for remote join event --- federationsender/internal/perform.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index 575a418c..fabb7e9e 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -259,24 +259,11 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer( // Find the membership event. var joinEvent *gomatrixserverlib.Event - var membership string - for _, event := range respState.StateEvents { - stateKey := event.StateKey() - if stateKey == nil { - continue + for _, stateEvent := range respState.StateEvents { + if stateEvent.EventID() == event.EventID() { + joinEvent = event + break } - if *stateKey != userID { - continue - } - membership, err = event.Membership() - if err != nil { - continue - } - if membership != gomatrixserverlib.Join { - continue - } - joinEvent = event - break } if joinEvent == nil { err = fmt.Errorf("The remote server did not send back our join event")