Allow users to edit their own settings

Also, don't use the flash anymore for going back to the referer.
This commit is contained in:
Eelco Dolstra
2013-03-04 15:25:23 +01:00
parent f831287d4b
commit a77161e40a
12 changed files with 207 additions and 232 deletions

View File

@ -24,16 +24,6 @@ sub api : Chained('/') PathPart('api') CaptureArgs(0) {
}
sub end : ActionClass('RenderView') {
my ($self, $c) = @_;
if (scalar @{$c->error}) {
$c->stash->{json}->{error} = join "\n", @{$c->error};
$c->forward('View::JSON');
$c->clear_errors;
}
}
sub projectToHash {
my ($project) = @_;
return {
@ -317,8 +307,6 @@ sub push : Chained('api') PathPart('push') Args(0) {
, where => \ [ 'exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value = ?)', [ 'value', $r ] ]
});
}
$c->forward('View::JSON');
}
@ -326,19 +314,17 @@ sub push_github : Chained('api') PathPart('push-github') Args(0) {
my ($self, $c) = @_;
$c->{stash}->{json}->{jobsetsTriggered} = [];
my $in = decode_json $c->req->body_params->{payload};
my $owner = $in->{repository}->{owner}->{name} or die;
my $repo = $in->{repository}->{name} or die;
print STDERR "got push from GitHub repository $owner/$repo\n";
triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search(
{ 'project.enabled' => 1, 'me.enabled' => 1 },
{ join => 'project'
, where => \ [ 'exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value like ?)', [ 'value', "%github.com%/$owner/$repo.git%" ] ]
});
$c->forward('View::JSON');
}