mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 23:52: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
|
@ -412,7 +412,7 @@ func Setup(
|
|||
},
|
||||
)).Methods(http.MethodPut)
|
||||
|
||||
v1fedmux.Handle("/make_leave/{roomID}/{eventID}", MakeFedAPI(
|
||||
v1fedmux.Handle("/make_leave/{roomID}/{userID}", MakeFedAPI(
|
||||
"federation_make_leave", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup,
|
||||
func(httpReq *http.Request, request *fclient.FederationRequest, vars map[string]string) util.JSONResponse {
|
||||
if roomserverAPI.IsServerBannedFromRoom(httpReq.Context(), rsAPI, vars["roomID"], request.Origin()) {
|
||||
|
@ -421,10 +421,22 @@ func Setup(
|
|||
JSON: spec.Forbidden("Forbidden by server ACLs"),
|
||||
}
|
||||
}
|
||||
roomID := vars["roomID"]
|
||||
eventID := vars["eventID"]
|
||||
roomID, err := spec.NewRoomID(vars["roomID"])
|
||||
if err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.InvalidParam("Invalid RoomID"),
|
||||
}
|
||||
}
|
||||
userID, err := spec.NewUserID(vars["userID"], true)
|
||||
if err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.InvalidParam("Invalid UserID"),
|
||||
}
|
||||
}
|
||||
return MakeLeave(
|
||||
httpReq, request, cfg, rsAPI, roomID, eventID,
|
||||
httpReq, request, cfg, rsAPI, *roomID, *userID,
|
||||
)
|
||||
},
|
||||
)).Methods(http.MethodGet)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue