aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-17 17:09:50 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-19 14:43:26 +0000
commit4ca398abb51f573bbab41f9335f2c102dfc190f2 (patch)
tree65b20ba1747a52bf379fc9ce503469349168bbb8
parent08b10660ba3324eeec4e2caa1d52ce5137475c0e (diff)
Allow unconfirmed reports to be seen on Zurich site.
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm11
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm4
-rw-r--r--t/app/controller/report_display.t13
4 files changed, 29 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 41aee3869..4888a39f3 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -83,7 +83,7 @@ sub load_problem_or_display_error : Private {
: $c->cobrand->problems->find( { id => $id } );
# check that the problem is suitable to show.
- if ( !$problem || $problem->state eq 'unconfirmed' || $problem->state eq 'partial' ) {
+ if ( !$problem || ($problem->state eq 'unconfirmed' && !$c->cobrand->show_unconfirmed_reports) || $problem->state eq 'partial' ) {
$c->detach( '/page_error_404_not_found', [ _('Unknown problem ID') ] );
}
elsif ( $problem->state eq 'hidden' ) {
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index c3f8b255e..998f287a1 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -723,5 +723,16 @@ until the contacts/area/body handling is rewritten to be better.
sub reports_by_body { 0; }
+=head2 show_unconfirmed_reports
+
+Whether reports in state 'unconfirmed' should still be shown on the public site.
+(They're always included in the admin interface.)
+
+=cut
+
+sub show_unconfirmed_reports {
+ 0;
+}
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 2cd2688fd..7255906c7 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -32,4 +32,8 @@ sub remove_redundant_areas {
}
}
+sub show_unconfirmed_reports {
+ 1;
+}
+
1;
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 5ae3bdfb3..9847e3e51 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -94,6 +94,19 @@ subtest "change report to unconfirmed and check for 404 status" => sub {
ok $report->update( { state => 'confirmed' } ), 'confirm report again';
};
+
+subtest "change report to unconfirmed and check for 404 status" => sub {
+ if ( !FixMyStreet::Cobrand->exists('zurich') ) {
+ plan skip_all => 'Skipping Zurich test without Zurich cobrand';
+ }
+ $mech->host( 'zurich.fixmystreet.com' );
+ ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
+ ok $mech->get("/report/$report_id"), "get '/report/$report_id'";
+ is $mech->res->code, 200, "page found";
+ ok $report->update( { state => 'confirmed' } ), 'confirm report again';
+ $mech->host( 'www.fixmystreet.com' );
+};
+
subtest "change report to hidden and check for 410 status" => sub {
ok $report->update( { state => 'hidden' } ), 'hide report';
ok $mech->get("/report/$report_id"), "get '/report/$report_id'";