aboutsummaryrefslogtreecommitdiff
path: root/roomserver/api
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-24 09:59:59 +0100
committerGitHub <noreply@github.com>2020-06-24 09:59:59 +0100
commit0577bfca55d1478bd1076d02f0b0623a3d3802a8 (patch)
tree05d39e8735e8ba1ef9b02c0cd7bfebe9610e9494 /roomserver/api
parent1f93427ed906f63925e2768120cf437e0b1e85fb (diff)
Pass join errors through internal API boundaries (#1157)
* Pass join errors through internal API boundaries Required for certain invite sytests. We will need to think of a better way of handling this going forwards. * Include m.room.avatar in stripped state; handle trailing slashes when GETing state events * Update whitelist * Update whitelist
Diffstat (limited to 'roomserver/api')
-rw-r--r--roomserver/api/perform.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/roomserver/api/perform.go b/roomserver/api/perform.go
index 3e5cae1b..0f5394c9 100644
--- a/roomserver/api/perform.go
+++ b/roomserver/api/perform.go
@@ -5,6 +5,17 @@ import (
"github.com/matrix-org/util"
)
+type JoinError int
+
+const (
+ // JoinErrorNotAllowed means the user is not allowed to join this room (e.g join_rule:invite or banned)
+ JoinErrorNotAllowed JoinError = 1
+ // JoinErrorBadRequest means the request was wrong in some way (invalid user ID, wrong server, etc)
+ JoinErrorBadRequest JoinError = 2
+ // JoinErrorNoRoom means that the room being joined doesn't exist.
+ JoinErrorNoRoom JoinError = 3
+)
+
type PerformJoinRequest struct {
RoomIDOrAlias string `json:"room_id_or_alias"`
UserID string `json:"user_id"`
@@ -13,7 +24,12 @@ type PerformJoinRequest struct {
}
type PerformJoinResponse struct {
+ // The room ID, populated on success.
RoomID string `json:"room_id"`
+ // The reason why the join failed. Can be blank.
+ Error JoinError `json:"error"`
+ // Debugging description of the error. Always present on failure.
+ ErrMsg string `json:"err_msg"`
}
type PerformLeaveRequest struct {