Permalink
Browse files

Admin controller: Use PathPart, not Path

Chaining paths only works properly when PathPart is used. Before this
fix, the affected URIs bypassed the top-level 'admin' sub.

Signed-off-by: Shea Levy <shea@shealevy.com>
  • Loading branch information...
1 parent c96e427 commit 94382bd8f06d747f592fa38065be93ef3d2a00fd @shlevy shlevy committed Mar 14, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/lib/Hydra/Controller/Admin.pm
@@ -32,21 +32,21 @@ sub machines : Chained('admin') PathPart('machines') Args(0) {
}
-sub clear_queue_non_current : Chained('admin') Path('clear-queue-non-current') Args(0) {
+sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
my ($self, $c) = @_;
$c->model('DB::Builds')->search({finished => 0, iscurrent => 0, busy => 0})->update({ finished => 1, buildstatus => 4, timestamp => time});
$c->res->redirect($c->request->referer // "/admin");
}
-sub clearfailedcache : Chained('admin') Path('clear-failed-cache') Args(0) {
+sub clearfailedcache : Chained('admin') PathPart('clear-failed-cache') Args(0) {
my ($self, $c) = @_;
my $r = `nix-store --clear-failed-paths '*'`;
$c->res->redirect($c->request->referer // "/admin");
}
-sub clearvcscache : Chained('admin') Path('clear-vcs-cache') Args(0) {
+sub clearvcscache : Chained('admin') PathPart('clear-vcs-cache') Args(0) {
my ($self, $c) = @_;
print "Clearing path cache\n";
@@ -65,7 +65,7 @@ sub clearvcscache : Chained('admin') Path('clear-vcs-cache') Args(0) {
}
-sub managenews : Chained('admin') Path('news') Args(0) {
+sub managenews : Chained('admin') PathPart('news') Args(0) {
my ($self, $c) = @_;
$c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, {order_by => 'createtime DESC'})];
@@ -74,7 +74,7 @@ sub managenews : Chained('admin') Path('news') Args(0) {
}
-sub news_submit : Chained('admin') Path('news/submit') Args(0) {
+sub news_submit : Chained('admin') PathPart('news/submit') Args(0) {
my ($self, $c) = @_;
requirePost($c);
@@ -92,7 +92,7 @@ sub news_submit : Chained('admin') Path('news/submit') Args(0) {
}
-sub news_delete : Chained('admin') Path('news/delete') Args(1) {
+sub news_delete : Chained('admin') PathPart('news/delete') Args(1) {
my ($self, $c, $id) = @_;
txn_do($c->model('DB')->schema, sub {

0 comments on commit 94382bd

Please sign in to comment.