mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 15:42:46 +00:00
Move MakeLeave
to GMSL (#3085)
Basically the same API shape as for `/make_join` https://github.com/matrix-org/gomatrixserverlib/pull/385
This commit is contained in:
parent
2eae8dc489
commit
5d6221d191
5 changed files with 108 additions and 89 deletions
|
@ -99,7 +99,7 @@ func MakeJoin(
|
|||
}
|
||||
|
||||
req := api.QueryServerJoinedToRoomRequest{
|
||||
ServerName: cfg.Matrix.ServerName,
|
||||
ServerName: request.Destination(),
|
||||
RoomID: roomID.String(),
|
||||
}
|
||||
res := api.QueryServerJoinedToRoomResponse{}
|
||||
|
@ -162,13 +162,13 @@ func MakeJoin(
|
|||
switch e := internalErr.(type) {
|
||||
case nil:
|
||||
case spec.InternalServerError:
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr)
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: spec.InternalServerError{},
|
||||
}
|
||||
case spec.MatrixError:
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr)
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
|
||||
code := http.StatusInternalServerError
|
||||
switch e.ErrCode {
|
||||
case spec.ErrorForbidden:
|
||||
|
@ -186,13 +186,13 @@ func MakeJoin(
|
|||
JSON: e,
|
||||
}
|
||||
case spec.IncompatibleRoomVersionError:
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr)
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: e,
|
||||
}
|
||||
default:
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr)
|
||||
util.GetLogger(httpReq.Context()).WithError(internalErr).Error("failed to handle make_join request")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.Unknown("unknown error"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue