Skip to content

Commit

Permalink
Don’t strip all spaces from Open311 categories.
Browse files Browse the repository at this point in the history
If a category’s send method is Open311, only strip spaces from the
ends of the code. We are aware of active Open311 servers that have
codes with spaces in the middle.
  • Loading branch information
dracos committed Oct 2, 2020
1 parent f4df25a commit bf90bf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion t/app/controller/admin/bodies.t
Expand Up @@ -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');
};

Expand Down

0 comments on commit bf90bf7

Please sign in to comment.