aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/joinroom.go
diff options
context:
space:
mode:
Diffstat (limited to 'clientapi/routing/joinroom.go')
-rw-r--r--clientapi/routing/joinroom.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/clientapi/routing/joinroom.go b/clientapi/routing/joinroom.go
index c50e552b..e371d921 100644
--- a/clientapi/routing/joinroom.go
+++ b/clientapi/routing/joinroom.go
@@ -37,6 +37,7 @@ func JoinRoomByIDOrAlias(
joinReq := roomserverAPI.PerformJoinRequest{
RoomIDOrAlias: roomIDOrAlias,
UserID: device.UserID,
+ IsGuest: device.AccountType == api.AccountTypeGuest,
Content: map[string]interface{}{},
}
joinRes := roomserverAPI.PerformJoinResponse{}
@@ -84,7 +85,14 @@ func JoinRoomByIDOrAlias(
if err := rsAPI.PerformJoin(req.Context(), &joinReq, &joinRes); err != nil {
done <- jsonerror.InternalAPIError(req.Context(), err)
} else if joinRes.Error != nil {
- done <- joinRes.Error.JSONResponse()
+ if joinRes.Error.Code == roomserverAPI.PerformErrorNotAllowed && device.AccountType == api.AccountTypeGuest {
+ done <- util.JSONResponse{
+ Code: http.StatusForbidden,
+ JSON: jsonerror.GuestAccessForbidden(joinRes.Error.Msg),
+ }
+ } else {
+ done <- joinRes.Error.JSONResponse()
+ }
} else {
done <- util.JSONResponse{
Code: http.StatusOK,