mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 08:03:09 -06:00
Fix statekey usage in syncapi/roomserver
This commit is contained in:
parent
909df4f935
commit
7eaa1c33d3
|
|
@ -373,7 +373,15 @@ func (s *OutputRoomEventConsumer) notifyJoinedPeeks(ctx context.Context, ev *rst
|
||||||
// TODO: check that it's a join and not a profile change (means unmarshalling prev_content)
|
// TODO: check that it's a join and not a profile change (means unmarshalling prev_content)
|
||||||
if membership == spec.Join {
|
if membership == spec.Join {
|
||||||
// check it's a local join
|
// check it's a local join
|
||||||
if _, _, err := s.cfg.Matrix.SplitLocalID('@', *ev.StateKey()); err != nil {
|
if ev.StateKey() == nil {
|
||||||
|
return sp, fmt.Errorf("unexpected nil state_key")
|
||||||
|
}
|
||||||
|
|
||||||
|
userID, err := s.rsAPI.QueryUserIDForSender(ctx, ev.RoomID(), spec.SenderID(*ev.StateKey()))
|
||||||
|
if err != nil || userID == nil {
|
||||||
|
return sp, fmt.Errorf("failed getting userID for sender: %w", err)
|
||||||
|
}
|
||||||
|
if !s.cfg.Matrix.IsLocalServerName(userID.Domain()) {
|
||||||
return sp, nil
|
return sp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,9 +403,15 @@ func (s *OutputRoomEventConsumer) onNewInviteEvent(
|
||||||
if msg.Event.StateKey() == nil {
|
if msg.Event.StateKey() == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, _, err := s.cfg.Matrix.SplitLocalID('@', *msg.Event.StateKey()); err != nil {
|
|
||||||
|
userID, err := s.rsAPI.QueryUserIDForSender(ctx, msg.Event.RoomID(), spec.SenderID(*msg.Event.StateKey()))
|
||||||
|
if err != nil || userID == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if !s.cfg.Matrix.IsLocalServerName(userID.Domain()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pduPos, err := s.db.AddInviteEvent(ctx, msg.Event)
|
pduPos, err := s.db.AddInviteEvent(ctx, msg.Event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sentry.CaptureException(err)
|
sentry.CaptureException(err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue