aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-09-20 15:23:58 +0100
committerDave Arter <davea@mysociety.org>2016-09-20 15:23:58 +0100
commit6f623cbb0c055fb4ae7f1a3639edaa212fc55392 (patch)
tree3a7990bbd47f0447af075ebf51996c94e5150e09 /perllib/FixMyStreet/App/Controller/Admin.pm
parente9a5d2fb6e1985a0d946ad3574234784f4f659c4 (diff)
Don't reject email when editing Open311 contacts
Fixes (the first part of) #1138.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 0a7b8d049..3fc5421ba 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -345,8 +345,6 @@ sub update_contacts : Private {
my $category = $self->trim( $c->get_param('category') );
$errors{category} = _("Please choose a category") unless $category;
- my $email = $self->trim( $c->get_param('email') );
- $errors{email} = _('Please enter a valid email') unless is_valid_email($email) || $email eq 'REFUSED';
$errors{note} = _('Please enter a message') unless $c->get_param('note');
my $contact = $c->model('DB::Contact')->find_or_new(
@@ -356,6 +354,12 @@ sub update_contacts : Private {
}
);
+ my $email = $self->trim( $c->get_param('email') );
+ my $send_method = $c->get_param('send_method') || $contact->send_method || $contact->body->send_method || "";
+ unless ( $send_method eq 'Open311' ) {
+ $errors{email} = _('Please enter a valid email') unless is_valid_email($email) || $email eq 'REFUSED';
+ }
+
$contact->email( $email );
$contact->confirmed( $c->get_param('confirmed') ? 1 : 0 );
$contact->deleted( $c->get_param('deleted') ? 1 : 0 );