aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2015-02-09 18:01:32 +0000
committerDave Arter <davea@mysociety.org>2015-10-06 09:09:24 +0100
commit34f3f5a36b6773ad51060256d4e95efd7c45b3c8 (patch)
tree5e656a15cc0bda3f930dc019d4dff664b8e035ac /perllib/FixMyStreet/App/Controller
parent2ff36453ebaa86e7f58f17ec63d2f95a88b8be99 (diff)
[Zurich] new status flags
Have moved the generation of banner text from the template into problem_as_hashref See mysociety/FixMyStreet-Commercial#672
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 279994e47..3aaa3e201 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -99,13 +99,20 @@ sub load_problem_or_display_error : Private {
my $problem
= ( !$id || $id =~ m{\D} ) # is id non-numeric?
? undef # ...don't even search
- : $c->cobrand->problems->find( { id => $id } );
+ : $c->cobrand->problems->find( { id => $id } )
+ or $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] );
# check that the problem is suitable to show.
- if ( !$problem || ($problem->state eq 'unconfirmed' && !$c->cobrand->show_unconfirmed_reports) || $problem->state eq 'partial' ) {
+ # hidden_states includes partial and unconfirmed, but they have specific handling,
+ # so we check for them first.
+ if ( $problem->state eq 'partial' ) {
$c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] );
}
- elsif ( $problem->state eq 'hidden' ) {
+ elsif ( $problem->state eq 'unconfirmed' ) {
+ $c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] )
+ unless $c->cobrand->show_unconfirmed_reports ;
+ }
+ elsif ( $problem->hidden_states->{ $problem->state } ) {
$c->detach(
'/page_error_410_gone',
[ _('That report has been removed from FixMyStreet.') ] #