aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan Parkes <duncan@mysociety.org>2010-12-25 00:16:13 +0000
committerDuncan Parkes <duncan@mysociety.org>2010-12-25 00:16:13 +0000
commitbbf4d55dd21732f71a31b85a926ff3bbc48ee015 (patch)
treecc92a465d75b3b2a36d45bbed48470763c44d61b
parent7acf747fe181d2e63499e80f235dc1a4ecd5098e (diff)
Don't lose state.
State was getting lost on redirects, so that a query for open issues using a lat and long or a postcode finished up as a query for all issues. Hopefully this should fix that.
-rwxr-xr-xweb/rss.cgi9
1 files changed, 6 insertions, 3 deletions
diff --git a/web/rss.cgi b/web/rss.cgi
index 6b43aeacb..a2ad74721 100755
--- a/web/rss.cgi
+++ b/web/rss.cgi
@@ -76,19 +76,22 @@ sub rss_local_problems {
$state = 'all' unless $state =~ /^(all|open|fixed)$/;
$state = 'confirmed' if $state eq 'open';
+ # state is getting lost in the redirects. Add it on to the end as a query
+ $state_qs = '?state=$state' unless $state eq 'all'
+
my $cobrand = Page::get_cobrand($q);
my $base = Cobrand::base_url($cobrand);
if ($lat) { # In the UK, it'll never be 0 :)
($e, $n) = mySociety::GeoUtil::wgs84_to_national_grid($lat, $lon, 'G');
$e = int($e + 0.5);
$n = int($n + 0.5);
- print $q->redirect(-location => "$base/rss/n/$e,$n$d_str");
+ print $q->redirect(-location => "$base/rss/n/$e,$n$d_str$state_qs");
return '';
} elsif ($x && $y) {
# 5000/31 as initial scale factor for these RSS feeds, now variable so redirect.
$e = int( ($x * 5000/31) + 0.5 );
$n = int( ($y * 5000/31) + 0.5 );
- print $q->redirect(-location => "$base/rss/n/$e,$n$d_str");
+ print $q->redirect(-location => "$base/rss/n/$e,$n$d_str$state_qs");
return '';
} elsif ($e && $n) {
($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($e, $n, 'G');
@@ -100,7 +103,7 @@ sub rss_local_problems {
$error = shift;
};
unless ($error) {
- print $q->redirect(-location => "$base/rss/n/$e,$n$d_str");
+ print $q->redirect(-location => "$base/rss/n/$e,$n$d_str$state_qs");
}
return '';
} else {