diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-04-22 11:58:11 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-04-22 12:54:12 +0100 |
commit | beee3223643a5611ee4aaa92e0b60fae7a13d839 (patch) | |
tree | 1ec06d65816d4283fa2f437491bb7e5a11580caf /perllib | |
parent | 42ce7397f1a1c0f59a1896d5f62d49ef4fe97b38 (diff) |
Send unresponsive body data per category to app.
The app doesn't currently use the unresponsive body data returned
via /report/new/ajax, so make sure it's returned via the category
look up it does make.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index cbf5782be..940e7153b 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -221,7 +221,7 @@ sub category_extras_ajax : Path('category_extras') : Args(0) { $c->forward('setup_categories_and_bodies'); $c->forward('check_for_category'); - my $category = $c->stash->{category}; + my $category = $c->stash->{category} || ""; my $category_extra = ''; my $generate; if ( $c->stash->{category_extras}->{$category} && @{ $c->stash->{category_extras}->{$category} } >= 1 ) { @@ -616,7 +616,16 @@ sub setup_categories_and_bodies : Private { $c->stash->{unresponsive} = {}; if (keys %bodies == 1 && $first_body->send_method && $first_body->send_method eq 'Refused') { - $c->stash->{unresponsive}{ALL} = $first_body->id; + # If there's only one body, and it's set to refused, we can show the + # message immediately, before they select a category. + if ($c->action->name eq 'category_extras_ajax' && $c->req->method eq 'POST') { + # The mobile app doesn't currently use this, in which case make + # sure the message is output, either below with a category, or when + # a blank category call is made. + $c->stash->{unresponsive}{""} = $first_body->id; + } else { + $c->stash->{unresponsive}{ALL} = $first_body->id; + } } # FIXME - implement in cobrand |