From 5a270ba59fdb21a3dea87030f9628d878f335b95 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 9 Nov 2021 16:16:04 +0000 Subject: [PATCH] Return 403s for now, might placate the tests --- federationapi/routing/join.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index 603e2cf50..2273f7383 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -204,13 +204,13 @@ func attemptMakeJoinForRestrictedMembership( if powerLevelsEvent, err := provider.PowerLevels(); err != nil { logger.WithError(err).Error("Failed to get power levels from auth events") return util.JSONResponse{ - Code: http.StatusBadRequest, + Code: http.StatusForbidden, // TODO: StatusBadRequest JSON: jsonerror.UnableToAuthoriseJoin("Room power levels do not exist"), } } else if err := json.Unmarshal(powerLevelsEvent.Content(), &powerLevels); err != nil { logger.WithError(err).Error("Failed to unmarshal power levels") return util.JSONResponse{ - Code: http.StatusBadRequest, + Code: http.StatusForbidden, // TODO: StatusBadRequest JSON: jsonerror.UnableToAuthoriseJoin("Failed to unmarshal room power levels"), } } @@ -328,7 +328,7 @@ func attemptMakeJoinForRestrictedMembership( // users had a suitable power level to invite other users, so we // don't have the ability to grant joins. return util.JSONResponse{ - Code: http.StatusBadRequest, + Code: http.StatusForbidden, // TODO: StatusBadRequest JSON: jsonerror.UnableToGrantJoin("None of the users from this homeserver have the power to invite"), } case ableToAuthoriseJoin && !foundUserInAnyRoom: @@ -342,7 +342,7 @@ func attemptMakeJoinForRestrictedMembership( // We don't seem to be joined to any of the allowed rooms, so we // can't even check if the join is supposed to be allowed or not. return util.JSONResponse{ - Code: http.StatusBadRequest, + Code: http.StatusForbidden, // TODO: StatusBadRequest JSON: jsonerror.UnableToAuthoriseJoin("This homeserver isn't joined to any of the allowed rooms"), } }