Update check for remote join event

This commit is contained in:
Neil Alexander 2021-11-15 10:26:12 +00:00
parent d0e7bc0f27
commit 623b61b3c2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -259,25 +259,12 @@ 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
}
if *stateKey != userID {
continue
}
membership, err = event.Membership()
if err != nil {
continue
}
if membership != gomatrixserverlib.Join {
continue
}
for _, stateEvent := range respState.StateEvents {
if stateEvent.EventID() == event.EventID() {
joinEvent = event
break
}
}
if joinEvent == nil {
err = fmt.Errorf("The remote server did not send back our join event")
logrus.WithFields(logrus.Fields{