diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-10-02 16:25:50 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-10-02 16:25:50 +0100 |
commit | 71abbedd5b0c6c7b0ae86b7ef75132fb68db6ff8 (patch) | |
tree | 311b274bb2998ac03a8b639faffc7b532c1ef2a0 | |
parent | c344dd774bc68dd1b9c7d41dc3c63c29ce4b3f42 (diff) | |
parent | bf90bf71fbac2c8e1be96646715182f876eccd57 (diff) |
Merge branch '3167-strip-space-middle'
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Bodies.pm | 6 | ||||
-rw-r--r-- | t/app/controller/admin/bodies.t | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b927fc319..b31e4cf95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Fix a few obscure asset layer changing issues. - Fix multiple disable messages for dropdown answers - Do not trigger duplicate check when checking stoppers + - Do not strip spaces from middle of Open311 category codes. #3167 - Admin improvements: - Display user name/email for contributed as reports. #2990 - Interface for enabling anonymous reports for certain categories. #2989 diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm index f88ad0051..670336c14 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm @@ -252,8 +252,12 @@ sub update_contact : Private { } my $email = $c->get_param('email'); - $email =~ s/\s+//g; my $send_method = $c->get_param('send_method') || $contact->body->send_method || ""; + if ($send_method eq 'Open311') { + $email =~ s/^\s+|\s+$//g; + } else { + $email =~ s/\s+//g; + } my $email_unchanged = $contact->email && $email && $contact->email eq $email; my $cobrand = $contact->body->get_cobrand_handler; my $cobrand_valid = $cobrand && $cobrand->call_hook(validate_contact_email => $email); diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t index 75db6f87c..b63cacd9d 100644 --- a/t/app/controller/admin/bodies.t +++ b/t/app/controller/admin/bodies.t @@ -231,9 +231,10 @@ subtest 'check open311 devolved editing' => sub { $mech->content_contains("name=\"category\"\n size=\"30\" value=\"test category\"\n required>", 'Can edit as now devolved'); $mech->submit_form_ok( { with_fields => { send_method => '', - email => 'open311-code', + email => 'open311 code', note => 'Removing email send method', } } ); + $mech->content_contains('open311 code'); $mech->content_contains('Values updated'); }; |