From a443d1e5f3796942f68067741f4bdd482548bfd7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 9 May 2022 16:25:22 +0100 Subject: [PATCH] Don't store invites in sync API that aren't relevant to local users (#2439) --- syncapi/consumers/roomserver.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go index 63bde8166..f0ca2106f 100644 --- a/syncapi/consumers/roomserver.go +++ b/syncapi/consumers/roomserver.go @@ -347,9 +347,11 @@ func (s *OutputRoomEventConsumer) onNewInviteEvent( ctx context.Context, msg api.OutputNewInviteEvent, ) { if msg.Event.StateKey() == nil { - log.WithFields(log.Fields{ - "event": string(msg.Event.JSON()), - }).Panicf("roomserver output log: invite has no state key") + return + } + if _, serverName, err := gomatrixserverlib.SplitID('@', *msg.Event.StateKey()); err != nil { + return + } else if serverName != s.cfg.Matrix.ServerName { return } pduPos, err := s.db.AddInviteEvent(ctx, msg.Event)