Skip to content

fix: Allow to stop or remove workspaces using rich and old parameters #6099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Allow to stop or remove workspaces using rich and old parameters
  • Loading branch information
mtojek committed Feb 8, 2023
commit 5eefe39ffd999e3aa776d644334a3d25b41838d9
3 changes: 2 additions & 1 deletion coderd/workspacebuilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
return
}

if len(legacyParameters) > 0 && len(parameters) > 0 {
if (createBuild.Transition == codersdk.WorkspaceTransitionStart || createBuild.Transition == codersdk.WorkspaceTransitionCreate) &&
len(legacyParameters) > 0 && len(parameters) > 0 {
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "Rich parameters can't be used together with legacy parameters.",
})
Expand Down
1 change: 1 addition & 0 deletions codersdk/workspacebuilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type WorkspaceTransition string

const (
WorkspaceTransitionCreate WorkspaceTransition = "create"
WorkspaceTransitionStart WorkspaceTransition = "start"
WorkspaceTransitionStop WorkspaceTransition = "stop"
WorkspaceTransitionDelete WorkspaceTransition = "delete"
Expand Down