diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 1cbed7e9..0352d656 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -131,6 +131,11 @@ sub submit : Chained('jobset') PathPart Args(0) { requireProjectOwner($c, $c->stash->{project}); requirePost($c); + if (($c->request->params->{submit} // "") eq "delete") { + $c->stash->{jobset}->delete; + return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), [$c->stash->{project}->name])); + } + txn_do($c->model('DB')->schema, sub { updateJobset($c, $c->stash->{jobset}); }); @@ -140,21 +145,6 @@ sub submit : Chained('jobset') PathPart Args(0) { } -sub delete : Chained('jobset') PathPart Args(0) { - my ($self, $c) = @_; - - requireProjectOwner($c, $c->stash->{project}); - requirePost($c); - - txn_do($c->model('DB')->schema, sub { - $c->stash->{jobset}->delete; - }); - - $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), - [$c->stash->{project}->name])); -} - - sub nixExprPathFromParams { my ($c) = @_; diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 9fe89be1..79de53a3 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -45,9 +45,9 @@ sub submit : Chained('project') PathPart Args(0) { requireProjectOwner($c, $c->stash->{project}); requirePost($c); - if (($c->request->params->{submit} || "") eq "delete") { + if (($c->request->params->{submit} // "") eq "delete") { $c->stash->{project}->delete; - $c->res->redirect($c->uri_for("/")); + return $c->res->redirect($c->uri_for("/")); } txn_do($c->model('DB')->schema, sub { diff --git a/src/root/edit-jobset.tt b/src/root/edit-jobset.tt index 75aa870a..b5886b6a 100644 --- a/src/root/edit-jobset.tt +++ b/src/root/edit-jobset.tt @@ -109,6 +109,18 @@