From a38d76783ee9a44b9e237a87d086549677d3282e Mon Sep 17 00:00:00 2001 From: Edmund von der Burg Date: Tue, 12 Apr 2011 12:32:58 +0100 Subject: Redirect locations queries from '/' to '/around' --- perllib/FixMyStreet/App/Controller/Root.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller/Root.pm') diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm index 461105b68..2dc770da5 100644 --- a/perllib/FixMyStreet/App/Controller/Root.pm +++ b/perllib/FixMyStreet/App/Controller/Root.pm @@ -33,11 +33,31 @@ sub auto : Private { =head2 index +Home page. + +If request includes certain parameters redirect to '/around' - this is to +preserve old behaviour. + =cut sub index : Path : Args(0) { my ( $self, $c ) = @_; + my @old_param_keys = ( 'pc', 'x', 'y', 'lat', 'lon' ); + my %old_params = (); + + foreach my $key (@old_param_keys) { + my $val = $c->req->param($key); + next unless $val; + $old_params{$key} = $val; + } + + if ( scalar keys %old_params ) { + my $around_uri = $c->uri_for( '/around', \%old_params ); + $c->res->redirect($around_uri); + return; + } + } =head2 default -- cgit v1.2.3