diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Catalyst/Plugin/Session/State/Cookie.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/My.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/Geocode/Bing.pm | 10 |
3 files changed, 22 insertions, 4 deletions
diff --git a/perllib/Catalyst/Plugin/Session/State/Cookie.pm b/perllib/Catalyst/Plugin/Session/State/Cookie.pm index ead8be38d..e0a651ed9 100644 --- a/perllib/Catalyst/Plugin/Session/State/Cookie.pm +++ b/perllib/Catalyst/Plugin/Session/State/Cookie.pm @@ -50,8 +50,9 @@ sub update_session_cookie { sub cookie_is_rejecting { my ( $c, $cookie ) = @_; - # Don't output cookie for JS files. mySociety addition - return 1 if substr($c->request->path, -3) eq '.js'; + # Don't output cookie for JS or JPEG files. mySociety addition + return 1 if substr($c->request->path, -3) eq '.js' + || substr($c->request->path, -5) eq '.jpeg'; if ( $cookie->{path} ) { return 1 if index '/'.$c->request->path, $cookie->{path}; diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm index 60e9dd09f..3de83b265 100644 --- a/perllib/FixMyStreet/App/Controller/My.pm +++ b/perllib/FixMyStreet/App/Controller/My.pm @@ -30,9 +30,16 @@ sub my : Path : Args(0) { my $pins = []; my $problems = {}; - my $rs = $c->user->problems->search( { + + my $params = { state => [ FixMyStreet::DB::Result::Problem->visible_states() ], - }, { + }; + $params = { + %{ $c->cobrand->problems_clause }, + %$params + } if $c->cobrand->problems_clause; + + my $rs = $c->user->problems->search( $params, { order_by => { -desc => 'confirmed' }, rows => 50 } )->page( $p_page ); diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm index f00cf9671..4ba00dbfe 100644 --- a/perllib/FixMyStreet/Geocode/Bing.pm +++ b/perllib/FixMyStreet/Geocode/Bing.pm @@ -59,10 +59,20 @@ sub string { foreach (@$results) { my $address = $_->{name}; next unless $_->{address}->{countryRegion} eq $params->{bing_country}; + + # Getting duplicate, yet different, results from Bing sometimes + next if @valid_locations + && $_->{address}{postalCode} && $valid_locations[-1]{address}{postalCode} eq $_->{address}{postalCode} + && ( $valid_locations[-1]{address}{locality} eq $_->{address}{adminDistrict2} + || $valid_locations[-1]{address}{adminDistrict2} eq $_->{address}{locality} + || $valid_locations[-1]{address}{locality} eq $_->{address}{locality} + ); + ( $latitude, $longitude ) = @{ $_->{point}->{coordinates} }; push (@$error, { address => $address, latitude => $latitude, longitude => $longitude }); push (@valid_locations, $_); } + return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1; return { error => $error }; } |