diff options
author | devonh <devon.dmytro@gmail.com> | 2023-05-17 00:33:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 00:33:27 +0000 |
commit | 67d68768574a234b733eb3e4061644fc098a69f6 (patch) | |
tree | 819e9a0a150b68181d91112ffc7e0d6030412b77 /clientapi/routing/admin.go | |
parent | 0489d16f95a3d9f1f5bc532e2060bd2482d7b156 (diff) |
Move MakeJoin logic to GMSL (#3081)
Diffstat (limited to 'clientapi/routing/admin.go')
-rw-r--r-- | clientapi/routing/admin.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clientapi/routing/admin.go b/clientapi/routing/admin.go index 4d2cea68..8dd662a1 100644 --- a/clientapi/routing/admin.go +++ b/clientapi/routing/admin.go @@ -31,7 +31,7 @@ func AdminEvacuateRoom(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAP } affected, err := rsAPI.PerformAdminEvacuateRoom(req.Context(), vars["roomID"]) - switch err { + switch err.(type) { case nil: case eventutil.ErrRoomNoExists: return util.JSONResponse{ @@ -113,7 +113,7 @@ func AdminResetPassword(req *http.Request, cfg *config.ClientAPI, device *api.De }, accAvailableResp); err != nil { return util.JSONResponse{ Code: http.StatusInternalServerError, - JSON: spec.InternalServerError(), + JSON: spec.InternalServerError{}, } } if accAvailableResp.Available { @@ -169,7 +169,10 @@ func AdminReindex(req *http.Request, cfg *config.ClientAPI, device *api.Device, _, err := natsClient.RequestMsg(nats.NewMsg(cfg.Matrix.JetStream.Prefixed(jetstream.InputFulltextReindex)), time.Second*10) if err != nil { logrus.WithError(err).Error("failed to publish nats message") - return spec.InternalServerError() + return util.JSONResponse{ + Code: http.StatusInternalServerError, + JSON: spec.InternalServerError{}, + } } return util.JSONResponse{ Code: http.StatusOK, @@ -231,10 +234,10 @@ func AdminDownloadState(req *http.Request, device *api.Device, rsAPI roomserverA } } if err = rsAPI.PerformAdminDownloadState(req.Context(), roomID, device.UserID, spec.ServerName(serverName)); err != nil { - if errors.Is(err, eventutil.ErrRoomNoExists) { + if errors.Is(err, eventutil.ErrRoomNoExists{}) { return util.JSONResponse{ Code: 200, - JSON: spec.NotFound(eventutil.ErrRoomNoExists.Error()), + JSON: spec.NotFound(err.Error()), } } logrus.WithError(err).WithFields(logrus.Fields{ |