Skip to content

Commit db94b30

Browse files
stirbyEmyrkaslilac
authored
fix: patch known issues in 2.14.1 (coder#14207)
* chore: revert status code change for delete users endpoint (coder#14168) Revert from coder#13870 (cherry picked from commit b80d995) * chore: delete user codersdk to support status code regression (coder#14173) * chore: delete user codersdk to support status code regression * Update codersdk/users.go Co-authored-by: Kayla Washburn-Love <mckayla@hey.com> --------- Co-authored-by: Kayla Washburn-Love <mckayla@hey.com> (cherry picked from commit b55a7a8) * fix: add template editor to /templates/:templateName route group (coder#14206) (cherry picked from commit d0feb70) --------- Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
1 parent a0411a3 commit db94b30

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

coderd/apidoc/docs.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/users.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ func (api *API) postUser(rw http.ResponseWriter, r *http.Request) {
513513
// @Security CoderSessionToken
514514
// @Tags Users
515515
// @Param user path string true "User ID, name, or me"
516-
// @Success 204
516+
// @Success 200
517517
// @Router /users/{user} [delete]
518518
func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
519519
ctx := r.Context()
@@ -588,7 +588,9 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) {
588588
}
589589
}
590590

591-
rw.WriteHeader(http.StatusNoContent)
591+
httpapi.Write(ctx, rw, http.StatusOK, codersdk.Response{
592+
Message: "User has been deleted!",
593+
})
592594
}
593595

594596
// Returns the parameterized user requested. All validation

codersdk/users.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error {
309309
return err
310310
}
311311
defer res.Body.Close()
312-
if res.StatusCode != http.StatusNoContent {
312+
// Check for a 200 or a 204 response. 2.14.0 accidentally included a 204 response,
313+
// which was a breaking change, and reverted in 2.14.1.
314+
if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusNoContent {
313315
return ReadBodyAsError(res)
314316
}
315317
return nil

docs/api/users.md

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/router.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ export const router = createBrowserRouter(
472472

473473
{/* Pages that don't have the dashboard layout */}
474474
<Route path="/:username/:workspace" element={<WorkspacePage />} />
475+
<Route
476+
path="/templates/:template/versions/:version/edit"
477+
element={<TemplateVersionEditorPage />}
478+
/>
475479
<Route
476480
path="/templates/:organization/:template/versions/:version/edit"
477481
element={<TemplateVersionEditorPage />}

0 commit comments

Comments
 (0)