aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Static.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-05-08 12:24:35 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-07-28 16:18:15 +0100
commit9d00e9bc88bde0c604a30d7f72890768b13ee7f0 (patch)
treedfbbb4496c2b4fe3d00ccd1e76e40d9b93108ad1 /perllib/FixMyStreet/App/Controller/Static.pm
parenta6390b55a0f05ef348b831ad76ce07834ac26e7e (diff)
[fixmystreet.com] Unresponsive bodies page/warning
Add a special category email address used to show an unresponsive message and page when trying to report in that category. Add a "Refused" send method for setting a whole body to be unresponsive and show the message immediately, not on category selection. Factor out category template, and put at top where needed.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Static.pm')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Static.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Static.pm b/perllib/FixMyStreet/App/Controller/Static.pm
index 8cd82b68e..d91a07fea 100755
--- a/perllib/FixMyStreet/App/Controller/Static.pm
+++ b/perllib/FixMyStreet/App/Controller/Static.pm
@@ -61,6 +61,25 @@ sub council : Global : Args(0) {
my ( $self, $c ) = @_;
}
+sub unresponsive : Global : Args(0) {
+ my ( $self, $c ) = @_;
+ my $body = $c->stash->{body} = $c->model('DB::Body')->find({ id => $c->get_param('body') })
+ or $c->detach( '/page_error_404_not_found' );
+
+ $c->stash->{category} = $c->get_param('category');
+
+ # If the whole body isn't set to refused, we need to check the contacts
+ if (!$body->send_method || $body->send_method ne 'Refused') {
+ my @contacts = $c->model('DB::Contact')->not_deleted->search( { body_id => $body->id } )->all;
+ my $any_unresponsive = 0;
+ foreach my $contact (@contacts) {
+ $any_unresponsive = 1 if $contact->email =~ /^REFUSED$/i;
+ }
+
+ $c->detach( '/page_error_404_not_found' ) unless $any_unresponsive;
+ }
+}
+
__PACKAGE__->meta->make_immutable;
1;