From 2ce90918cd61d1f06276eb118fa305f9311acd3e Mon Sep 17 00:00:00 2001 From: Albert Ting Date: Mon, 5 Dec 2011 20:27:32 +0100 Subject: Bug 422256: email_in.pl should send an email if user matching fails or returns too many results r/a=mkanat --- email_in.pl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'email_in.pl') diff --git a/email_in.pl b/email_in.pl index f16d56175..888fa2be4 100755 --- a/email_in.pl +++ b/email_in.pl @@ -169,22 +169,29 @@ sub parse_mail { return \%fields; } -sub post_bug { +sub check_email_fields { my ($fields) = @_; - debug_print('Posting a new bug...'); - - my $user = Bugzilla->user; my ($retval, $non_conclusive_fields) = Bugzilla::User::match_field({ 'assigned_to' => { 'type' => 'single' }, 'qa_contact' => { 'type' => 'single' }, - 'cc' => { 'type' => 'multi' } + 'cc' => { 'type' => 'multi' }, + 'newcc' => { 'type' => 'multi' } }, $fields, MATCH_SKIP_CONFIRM); if ($retval != USER_MATCH_SUCCESS) { ThrowUserError('user_match_too_many', {fields => $non_conclusive_fields}); } +} + +sub post_bug { + my ($fields) = @_; + debug_print('Posting a new bug...'); + + my $user = Bugzilla->user; + + check_email_fields($fields); my $bug = Bugzilla::Bug->create($fields); debug_print("Created bug " . $bug->id); @@ -225,6 +232,8 @@ sub process_bug { $fields{'removecc'} = 1; } + check_email_fields(\%fields); + my $cgi = Bugzilla->cgi; foreach my $field (keys %fields) { $cgi->param(-name => $field, -value => $fields{$field}); -- cgit v1.2.3-24-g4f1b