From f10dab805a249b6bee9df732c3707ad5754b338b Mon Sep 17 00:00:00 2001 From: ngoomie Date: Mon, 19 Aug 2024 21:41:58 -0600 Subject: [PATCH] Fix bug with subforum routes Subforum-related routes have been repositioned to the bottom of the routes list, as putting them above other routes would make them "override" the routes below. i.e. `/logout` would be treated as though you were trying to view a subforum named `logout` --- lib/CharmBoard.pm | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/CharmBoard.pm b/lib/CharmBoard.pm index f6d0f8f..c2acbc6 100644 --- a/lib/CharmBoard.pm +++ b/lib/CharmBoard.pm @@ -74,21 +74,6 @@ sub startup { controller => 'Controller::Index', action => 'index' ); - # view subforum - $r->get('/:id')->to( - controller => 'Controller::ViewSubf', - action => 'subf_view' - ); - - # create thread - $r->get('/:id/new')->to( - controller => 'Controller::NewThread', - action => 'thread_compose' - ); - $r->post('/:id/new')->to( - controller => 'Controller::NewThread', - action => 'thread_submit' - ); ## registration page $r->get('/register')->to( @@ -114,7 +99,24 @@ sub startup { $r->get('/logout')->to( controller => 'Controller::Logout', action => 'logout_do' - ) + ); + + # view subforum + # NOTE: keep these at THE BOTTOM of routes, otherwise they override the above routes. + $r->get('/:id')->to( + controller => 'Controller::ViewSubf', + action => 'subf_view' + ); + + # create thread + $r->get('/:id/new')->to( + controller => 'Controller::NewThread', + action => 'thread_compose' + ); + $r->post('/:id/new')->to( + controller => 'Controller::NewThread', + action => 'thread_submit' + ); } 1;