From d5c1d67198505cc72845d512628852ace9ce799e Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 26 Aug 2014 12:51:09 +0800 Subject: Bug 1051655: mentor field updated/reset when a bug is updated as a result of a change on a different bug (eg. see also, duplicate) --- process_bug.cgi | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index 20875fb29..39823f88e 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -58,6 +58,7 @@ use Bugzilla::Keyword; use Bugzilla::Flag; use Bugzilla::Status; use Bugzilla::Token; +use Bugzilla::Hook; use List::MoreUtils qw(firstidx); use Storable qw(dclone); @@ -133,12 +134,15 @@ if (defined $cgi->param('dontchange')) { } # do a match on the fields if applicable -Bugzilla::User::match_field({ - 'qa_contact' => { 'type' => 'single' }, - 'newcc' => { 'type' => 'multi' }, - 'masscc' => { 'type' => 'multi' }, - 'assigned_to' => { 'type' => 'single' }, -}); +# BMO: allow extensions to define custom user fields +my $user_match_fields = { + 'qa_contact' => { 'type' => 'single' }, + 'newcc' => { 'type' => 'multi' }, + 'masscc' => { 'type' => 'multi' }, + 'assigned_to' => { 'type' => 'single' }, +}; +Bugzilla::Hook::process('bug_user_match_fields', { fields => $user_match_fields }); +Bugzilla::User::match_field($user_match_fields); print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_EMAIL; @@ -371,6 +375,13 @@ foreach my $field (@custom_fields) { } } +# BMO - add user_match_fields. it's important to source from input_params +# instead of $cgi->param to ensure we get the correct value. +foreach my $field (keys %$user_match_fields) { + next if exists $set_all_fields{$field}; + $set_all_fields{$field} = Bugzilla->input_params->{$field} // []; +} + # We are going to alter the list of removed groups, so we keep a copy here. my @unchecked_groups = @$removed_groups; foreach my $b (@bug_objects) { -- cgit v1.2.3-24-g4f1b