mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 05:13:11 -06:00
Don't default to federated room joins in response to invite
This commit is contained in:
parent
107937749b
commit
b2dc3f9f49
|
|
@ -127,14 +127,23 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
|||
// latest state as all of our users have left.
|
||||
isInvitePending, inviteSender, err := r.isInvitePending(ctx, req.RoomIDOrAlias, req.UserID)
|
||||
if err == nil && isInvitePending {
|
||||
// Add the server of the person who invited us to the server list,
|
||||
// as they should be a fairly good bet.
|
||||
if _, inviterDomain, ierr := gomatrixserverlib.SplitID('@', inviteSender); ierr == nil {
|
||||
req.ServerNames = append(req.ServerNames, inviterDomain)
|
||||
// Check if there's an invite pending.
|
||||
_, inviterDomain, ierr := gomatrixserverlib.SplitID('@', inviteSender)
|
||||
if ierr != nil {
|
||||
return fmt.Errorf("gomatrixserverlib.SplitID: %w", err)
|
||||
}
|
||||
|
||||
// Perform a federated room join.
|
||||
return r.performFederatedJoinRoomByID(ctx, req, res)
|
||||
// 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,
|
||||
// as they should be a fairly good bet.
|
||||
req.ServerNames = append(req.ServerNames, inviterDomain)
|
||||
|
||||
// Perform a federated room join.
|
||||
return r.performFederatedJoinRoomByID(ctx, req, res)
|
||||
}
|
||||
}
|
||||
|
||||
// Try to construct an actual join event from the template.
|
||||
|
|
|
|||
Loading…
Reference in a new issue