mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 16:13:10 -06:00
Fix statekey usage in roomserver/perform_invite
This commit is contained in:
parent
1e4fa2791c
commit
d3a0101eb5
|
|
@ -134,12 +134,12 @@ func (r *Inviter) PerformInvite(
|
|||
return api.ErrInvalidID{Err: fmt.Errorf("the invite must be from a local user")}
|
||||
}
|
||||
|
||||
if event.StateKey() == nil {
|
||||
if event.StateKey() == nil || *event.StateKey() == "" {
|
||||
return fmt.Errorf("invite must be a state event")
|
||||
}
|
||||
invitedUser, err := spec.NewUserID(*event.StateKey(), true)
|
||||
if err != nil {
|
||||
return spec.InvalidParam("The user ID is invalid")
|
||||
invitedUser, err := r.RSAPI.QueryUserIDForSender(ctx, event.RoomID(), spec.SenderID(*event.StateKey()))
|
||||
if err != nil || invitedUser == nil {
|
||||
return spec.InvalidParam("Could not find the matching senderID for this user")
|
||||
}
|
||||
isTargetLocal := r.Cfg.Matrix.IsLocalServerName(invitedUser.Domain())
|
||||
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ func (r *Upgrader) generateInitialEvents(ctx context.Context, oldRoom *api.Query
|
|||
}
|
||||
}
|
||||
// skip events that rely on a specific user being present
|
||||
// TODO: What to do here for pseudoIDs? It's checking non-member events for state keys with userIDs.
|
||||
sKey := *event.StateKey()
|
||||
if event.Type() != spec.MRoomMember && len(sKey) > 0 && sKey[:1] == "@" {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue