aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-05-09 16:25:22 +0100
committerGitHub <noreply@github.com>2022-05-09 16:25:22 +0100
commita443d1e5f3796942f68067741f4bdd482548bfd7 (patch)
tree2b856bd33d0457067ef1ccc4c334afbab9fbde12
parent79da75d483d3ee554722000975e13776e4e8a656 (diff)
Don't store invites in sync API that aren't relevant to local users (#2439)
-rw-r--r--syncapi/consumers/roomserver.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go
index 63bde816..f0ca2106 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)