mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Federation sender to ignore invites that are destined locally
This commit is contained in:
parent
7ac699bc77
commit
7ff2bbf13e
|
|
@ -188,6 +188,25 @@ func (s *OutputRoomEventConsumer) processInvite(oie api.OutputNewInviteEvent) er
|
|||
return nil
|
||||
}
|
||||
|
||||
// Ignore invites that don't have state keys - they are invalid.
|
||||
if oie.Event.StateKey() == nil {
|
||||
return fmt.Errorf("event %q doesn't have state key", oie.Event.EventID())
|
||||
}
|
||||
|
||||
// Don't try to handle events that are actually destined for us.
|
||||
stateKey := *oie.Event.StateKey()
|
||||
_, destination, err := gomatrixserverlib.SplitID('@', stateKey)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"event_id": oie.Event.EventID(),
|
||||
"state_key": stateKey,
|
||||
}).Info("failed to split destination from state key")
|
||||
return nil
|
||||
}
|
||||
if s.cfg.Matrix.ServerName == destination {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Try to extract the room invite state. The roomserver will have stashed
|
||||
// this for us in invite_room_state if it didn't already exist.
|
||||
strippedState := []gomatrixserverlib.InviteV2StrippedState{}
|
||||
|
|
|
|||
Loading…
Reference in a new issue