mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
POST /join/{roomId}: Allow joining even when not invited #663
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
170264404e
commit
efa98b35ee
|
|
@ -119,16 +119,14 @@ func (r joinRoomReq) joinRoomByID(roomID string) util.JSONResponse {
|
||||||
return httputil.LogThenError(r.req, err)
|
return httputil.LogThenError(r.req, err)
|
||||||
}
|
}
|
||||||
if len(queryRes.InviteSenderUserIDs) == 0 {
|
if len(queryRes.InviteSenderUserIDs) == 0 {
|
||||||
// TODO: We might need to support clients which erroneously try to join
|
// Support clients erroneously trying to join without an invite
|
||||||
// the room by ID even when they are not invited.
|
_, domain, err := gomatrixserverlib.SplitID('!', roomID)
|
||||||
// This can be done by removing this check and falling through to
|
if err != nil {
|
||||||
// joinRoomUsingServers passing an empty list since joinRoomUserServers
|
return httputil.LogThenError(r.req, err)
|
||||||
// will check if we are already in the room first.
|
|
||||||
return util.JSONResponse{
|
|
||||||
Code: http.StatusForbidden,
|
|
||||||
JSON: jsonerror.Forbidden("You are not invited to the room"),
|
|
||||||
}
|
}
|
||||||
|
return r.joinRoomUsingServers(roomID, []gomatrixserverlib.ServerName{domain})
|
||||||
}
|
}
|
||||||
|
|
||||||
servers := []gomatrixserverlib.ServerName{}
|
servers := []gomatrixserverlib.ServerName{}
|
||||||
seenBefore := map[gomatrixserverlib.ServerName]bool{}
|
seenBefore := map[gomatrixserverlib.ServerName]bool{}
|
||||||
for _, userID := range queryRes.InviteSenderUserIDs {
|
for _, userID := range queryRes.InviteSenderUserIDs {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue