diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 35 |
3 files changed, 17 insertions, 26 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 15a220644..037458538 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -413,6 +413,8 @@ sub summary : Private { my ($self, $c) = @_; my $dashboard = $c->forward('load_dashboard_data'); + $c->log->info($c->user->email . ' viewed ' . $c->req->uri->path_query) if $c->user_exists; + eval { my $data = path(FixMyStreet->path_to('../data/all-reports-dashboard.json'))->slurp_utf8; $data = decode_json($data); diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 591234877..6c826ec01 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -136,7 +136,7 @@ sub about_hook { $c->stash->{form_name} = $c->get_param('name') || ''; $c->stash->{email} = $c->get_param('username') || ''; if ($c->user_exists) { - my $body = _user_to_body($c); + my $body = $c->user->from_body || _user_to_body($c); if ($body) { $c->stash->{body} = $body; $c->stash->{wards} = [ { name => 'summary' } ]; @@ -152,9 +152,7 @@ sub about_hook { $c->stash->{template} = 'auth/general.html'; $c->detach('/auth/general'); } else { - $c->stash->{no_body_found} = 1; - $c->set_param('em', $email); # What the contact form wants - $c->detach('/contact/submit'); + $c->stash->{error} = 'bad_email'; } } } diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index ebc6e6c1b..e262cb63e 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -132,34 +132,25 @@ sub _recent { }; my $probs; - my $new = 0; - if (defined $lat) { - my $dist2 = $dist; # Create a copy of the variable to stop it being stringified into a locale in the next line! - $key .= ":$lat:$lon:$dist2"; - $probs = Memcached::get($key); - unless ($probs) { - $attrs->{bind} = [ $lat, $lon, $dist ]; - $attrs->{join} = 'nearby'; - $probs = [ mySociety::Locale::in_gb_locale { - $rs->search( $query, $attrs )->all; - } ]; - $new = 1; - } + if (defined $lat) { # No caching + $attrs->{bind} = [ $lat, $lon, $dist ]; + $attrs->{join} = 'nearby'; + $probs = [ mySociety::Locale::in_gb_locale { + $rs->search( $query, $attrs )->all; + } ]; } else { $probs = Memcached::get($key); - unless ($probs) { + if ($probs) { + # Need to reattach schema so that confirmed column gets reinflated. + $probs->[0]->result_source->schema( $rs->result_source->schema ) if $probs->[0]; + # Catch any cached ones since hidden + $probs = [ grep { ! $_->is_hidden } @$probs ]; + } else { $probs = [ $rs->search( $query, $attrs )->all ]; - $new = 1; + Memcached::set($key, $probs, 3600); } } - if ( $new ) { - Memcached::set($key, $probs, 3600); - } else { - # Need to reattach schema so that confirmed column gets reinflated. - $probs->[0]->result_source->schema( $rs->result_source->schema ) if $probs->[0]; - } - return $probs; } |