Fix joins to rooms that we know about that have room IDs with our server part (#1178)
parent
38caf8e5b7
commit
9dffeb9b67
|
@ -124,7 +124,13 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
||||||
Msg: fmt.Sprintf("Room ID %q is invalid: %s", req.RoomIDOrAlias, err),
|
Msg: fmt.Sprintf("Room ID %q is invalid: %s", req.RoomIDOrAlias, err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the server name in the room ID isn't ours then it's a
|
||||||
|
// possible candidate for finding the room via federation. Add
|
||||||
|
// it to the list of servers to try.
|
||||||
|
if domain != r.Cfg.Matrix.ServerName {
|
||||||
req.ServerNames = append(req.ServerNames, domain)
|
req.ServerNames = append(req.ServerNames, domain)
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the template for the join event.
|
// Prepare the template for the join event.
|
||||||
userID := req.UserID
|
userID := req.UserID
|
||||||
|
@ -233,15 +239,20 @@ func (r *RoomserverInternalAPI) performJoinRoomByID(
|
||||||
}
|
}
|
||||||
|
|
||||||
case eventutil.ErrRoomNoExists:
|
case eventutil.ErrRoomNoExists:
|
||||||
// The room doesn't exist. First of all check if the room is a local
|
// The room doesn't exist locally. If the room ID looks like it should
|
||||||
// room. If it is then there's nothing more to do - the room just
|
// be ours then this probably means that we've nuked our database at
|
||||||
// hasn't been created yet.
|
// some point.
|
||||||
if domain == r.Cfg.Matrix.ServerName {
|
if domain == r.Cfg.Matrix.ServerName {
|
||||||
|
// If there are no more server names to try then give up here.
|
||||||
|
// Otherwise we'll try a federated join as normal, since it's quite
|
||||||
|
// possible that the room still exists on other servers.
|
||||||
|
if len(req.ServerNames) == 0 {
|
||||||
return "", &api.PerformError{
|
return "", &api.PerformError{
|
||||||
Code: api.PerformErrorNoRoom,
|
Code: api.PerformErrorNoRoom,
|
||||||
Msg: fmt.Sprintf("Room ID %q does not exist", req.RoomIDOrAlias),
|
Msg: fmt.Sprintf("Room ID %q does not exist", req.RoomIDOrAlias),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Perform a federated room join.
|
// Perform a federated room join.
|
||||||
return req.RoomIDOrAlias, r.performFederatedJoinRoomByID(ctx, req)
|
return req.RoomIDOrAlias, r.performFederatedJoinRoomByID(ctx, req)
|
||||||
|
|
Loading…
Reference in New Issue