forked from lix-project/hydra
Use notFound instead of status_not_found
This commit is contained in:
parent
2166c478ef
commit
4ddb173ca1
2 changed files with 14 additions and 27 deletions
|
@ -12,31 +12,21 @@ sub jobsetChain :Chained('/') :PathPart('jobset') :CaptureArgs(2) {
|
||||||
|
|
||||||
my $project = $c->model('DB::Projects')->find($projectName);
|
my $project = $c->model('DB::Projects')->find($projectName);
|
||||||
|
|
||||||
if ($project) {
|
notFound($c, "Project ‘$projectName’ doesn't exist.") if !$project;
|
||||||
$c->stash->{project} = $project;
|
|
||||||
|
|
||||||
$c->stash->{jobset_} = $project->jobsets->search({'me.name' => $jobsetName});
|
$c->stash->{project} = $project;
|
||||||
my $jobset = $c->stash->{jobset_}->single;
|
|
||||||
|
|
||||||
if ($jobset) {
|
$c->stash->{jobset_} = $project->jobsets->search({'me.name' => $jobsetName});
|
||||||
$c->stash->{jobset} = $jobset;
|
my $jobset = $c->stash->{jobset_}->single;
|
||||||
} else {
|
|
||||||
if ($c->action->name eq "jobset" and $c->request->method eq "PUT") {
|
if ($jobset) {
|
||||||
$c->stash->{jobsetName} = $jobsetName;
|
$c->stash->{jobset} = $jobset;
|
||||||
} else {
|
|
||||||
$self->status_not_found(
|
|
||||||
$c,
|
|
||||||
message => "Jobset $jobsetName doesn't exist."
|
|
||||||
);
|
|
||||||
$c->detach;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$self->status_not_found(
|
if ($c->action->name eq "jobset" and $c->request->method eq "PUT") {
|
||||||
$c,
|
$c->stash->{jobsetName} = $jobsetName;
|
||||||
message => "Project $projectName doesn't exist."
|
} else {
|
||||||
);
|
notFound($c, "Jobset ‘$jobsetName’ doesn't exist.");
|
||||||
$c->detach;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package Hydra::Controller::Project;
|
package Hydra::Controller::Project;
|
||||||
|
|
||||||
use utf8;
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use base 'Hydra::Base::Controller::ListBuilds';
|
use base 'Hydra::Base::Controller::ListBuilds';
|
||||||
|
@ -27,10 +26,8 @@ sub projectChain :Chained('/') :PathPart('project') :CaptureArgs(1) {
|
||||||
"jobsets.enabled",
|
"jobsets.enabled",
|
||||||
], join => [ 'owner', 'releases', 'jobsets' ], order_by => { -desc => "releases.timestamp" }, collapse => 1 });
|
], join => [ 'owner', 'releases', 'jobsets' ], order_by => { -desc => "releases.timestamp" }, collapse => 1 });
|
||||||
|
|
||||||
if (!$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT")) {
|
notFound($c, "Project ‘$projectName’ doesn't exist.")
|
||||||
$self->status_not_found($c, message => "Project ‘$projectName’ doesn't exist.");
|
if (!$c->stash->{project} && !($c->action->name eq "project" and $c->request->method eq "PUT"));
|
||||||
$c->detach;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue