diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 72a9852fc..996e990a8 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -155,10 +155,13 @@ sub _recent { } else { $probs = Memcached::get($key); 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 { $_->photo && ! $_->is_hidden && !$_->non_public } @$probs ]; + # Need to refetch to check if hidden since cached + $probs = [ $rs->search({ + id => [ map { $_->id } @$probs ], + photo => { '!=', undef }, + non_public => 'f', + state => [ FixMyStreet::DB::Result::Problem->visible_states() ], + })->all ]; } else { $probs = [ $rs->search( $query, $attrs )->all ]; Memcached::set($key, $probs, _cache_timeout()); |