mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: allow users to extend their running workspace's deadline (#15895)
Fixes https://github.com/coder/coder/issues/15515 This change effectively reverts the changes introduced by https://github.com/coder/coder/pull/13182 (for https://github.com/coder/coder/issues/13078). We also rename the `override-stop` command name to `extend` to match the API endpoint's name (keeping an alias to allow `override-stop` to be used).
This commit is contained in:
@@ -1200,18 +1200,6 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
|
||||
return xerrors.Errorf("workspace shutdown is manual")
|
||||
}
|
||||
|
||||
tmpl, err := s.GetTemplateByID(ctx, workspace.TemplateID)
|
||||
if err != nil {
|
||||
code = http.StatusInternalServerError
|
||||
resp.Message = "Error fetching template."
|
||||
return xerrors.Errorf("get template: %w", err)
|
||||
}
|
||||
if !tmpl.AllowUserAutostop {
|
||||
code = http.StatusBadRequest
|
||||
resp.Message = "Cannot extend workspace: template does not allow user autostop."
|
||||
return xerrors.New("cannot extend workspace: template does not allow user autostop")
|
||||
}
|
||||
|
||||
newDeadline := req.Deadline.UTC()
|
||||
if err := validWorkspaceDeadline(job.CompletedAt.Time, newDeadline); err != nil {
|
||||
// NOTE(Cian): Putting the error in the Message field on request from the FE folks.
|
||||
|
||||
Reference in New Issue
Block a user