aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-09-04 17:52:07 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-09-04 17:52:36 +0100
commit66341842f7d45bb8ee0f9ed8126d9d1c486c769f (patch)
treebe0be3cf0329e45678a71ab0258b7d676f9ab224
parent1d78ea3872d48c9184e9b1df183c5d5a0c1d605f (diff)
Make sure extras hidden when only_send is active.
The extras may be a confusing stopper message that only applies to the 'main' body, or it may be extra questions that are now not required. Either way, we should hide this information, and we need to make sure the server no longer checks if required extra questions have been answered.
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm11
-rw-r--r--web/cobrands/westminster/assets.js1
2 files changed, 11 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index c41b65e2a..103509863 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1025,7 +1025,16 @@ sub process_report : Private {
my $body_string = do {
if (my $single_body_only = $c->get_param('single_body_only')) {
my $body = $c->model('DB::Body')->search({ name => $single_body_only })->first;
- $body ? $body->id : '-1';
+ if ($body) {
+ # Drop the contacts down to those in this body
+ # (potentially none for e.g. Highways England)
+ # so that set_report_extras doesn't error when
+ # there are 'missing' extra fields
+ @contacts = grep { $_->body->id == $body->id } @contacts;
+ $body->id;
+ } else {
+ '-1';
+ }
} else {
my $contact_options = {};
$contact_options->{do_not_send} = [ $c->get_param_list('do_not_send', 1) ];
diff --git a/web/cobrands/westminster/assets.js b/web/cobrands/westminster/assets.js
index de6e7c4c6..1c0358301 100644
--- a/web/cobrands/westminster/assets.js
+++ b/web/cobrands/westminster/assets.js
@@ -101,6 +101,7 @@ fixmystreet.assets.add(defaults, {
found: function(layer, feature) {
if (!fixmystreet.assets.selectedFeature()) {
fixmystreet.body_overrides.only_send('TfL');
+ $('#category_meta').empty();
} else {
fixmystreet.body_overrides.remove_only_send();
}