mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 21:33:19 -06:00
Don't default to federated room joins in response to invite
This commit is contained in:
parent
107937749b
commit
b2dc3f9f49
|
|
@ -127,15 +127,24 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
||||||
// latest state as all of our users have left.
|
// latest state as all of our users have left.
|
||||||
isInvitePending, inviteSender, err := r.isInvitePending(ctx, req.RoomIDOrAlias, req.UserID)
|
isInvitePending, inviteSender, err := r.isInvitePending(ctx, req.RoomIDOrAlias, req.UserID)
|
||||||
if err == nil && isInvitePending {
|
if err == nil && isInvitePending {
|
||||||
|
// Check if there's an invite pending.
|
||||||
|
_, inviterDomain, ierr := gomatrixserverlib.SplitID('@', inviteSender)
|
||||||
|
if ierr != nil {
|
||||||
|
return fmt.Errorf("gomatrixserverlib.SplitID: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the domain isn't ours. If it's local then we don't
|
||||||
|
// need to do anythig as our own copy of the room state will be
|
||||||
|
// up-to-date.
|
||||||
|
if inviterDomain != r.Cfg.Matrix.ServerName {
|
||||||
// Add the server of the person who invited us to the server list,
|
// Add the server of the person who invited us to the server list,
|
||||||
// as they should be a fairly good bet.
|
// as they should be a fairly good bet.
|
||||||
if _, inviterDomain, ierr := gomatrixserverlib.SplitID('@', inviteSender); ierr == nil {
|
|
||||||
req.ServerNames = append(req.ServerNames, inviterDomain)
|
req.ServerNames = append(req.ServerNames, inviterDomain)
|
||||||
}
|
|
||||||
|
|
||||||
// Perform a federated room join.
|
// Perform a federated room join.
|
||||||
return r.performFederatedJoinRoomByID(ctx, req, res)
|
return r.performFederatedJoinRoomByID(ctx, req, res)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try to construct an actual join event from the template.
|
// Try to construct an actual join event from the template.
|
||||||
// If this succeeds then it is a sign that the room already exists
|
// If this succeeds then it is a sign that the room already exists
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue