From ca8762f064d4be411b72923354259013e2f0450f Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Tue, 23 Apr 2013 11:40:29 -0400 Subject: Bug 864304 - Requesting needinfo from more than one person is annoying --- extensions/Needinfo/Extension.pm | 45 +++++++++++++--------- .../template/en/default/bug/needinfo.html.tmpl | 12 +++--- 2 files changed, 34 insertions(+), 23 deletions(-) (limited to 'extensions/Needinfo') diff --git a/extensions/Needinfo/Extension.pm b/extensions/Needinfo/Extension.pm index e88e764b2..f6cc7d256 100644 --- a/extensions/Needinfo/Extension.pm +++ b/extensions/Needinfo/Extension.pm @@ -60,7 +60,7 @@ sub bug_start_of_update { if ($user->in_group('canconfirm') && $params->{needinfo}) { # do a match if applicable Bugzilla::User::match_field({ - 'needinfo_from' => { 'type' => 'single' } + 'needinfo_from' => { 'type' => 'multi' } }); } @@ -88,43 +88,52 @@ sub bug_start_of_update { if ($user->in_group('canconfirm') && $needinfo) { foreach my $type (@{ $bug->flag_types }) { next if $type->name ne 'needinfo'; + my %requestees; - my $needinfo_flag = { type_id => $type->id, status => '?' }; - + # Allow anyone to be the requestee + if (!$needinfo_role) { + $requestees{'anyone'} = 1; + } # Use assigned_to as requestee - if ($needinfo_role eq 'assigned_to') { - $needinfo_flag->{requestee} = $bug->assigned_to->login; + elsif ($needinfo_role eq 'assigned_to') { + $requestees{$bug->assigned_to->login} = 1; } # Use reporter as requestee elsif ( $needinfo_role eq 'reporter') { - $needinfo_flag->{requestee} = $bug->reporter->login; + $requestees{$bug->reporter->login} = 1; } # Use qa_contact as requestee elsif ($needinfo_role eq 'qa_contact') { - $needinfo_flag->{requestee} = $bug->qa_contact->login; + $requestees{$bug->qa_contact->login} = 1; } # Use user specified requestee elsif ($needinfo_role eq 'other' && $needinfo_from) { - Bugzilla::User->check($needinfo_from); - $needinfo_flag->{requestee} = $needinfo_from; + my @needinfo_from_list = ref $needinfo_from + ? @$needinfo_from : + ($needinfo_from); + foreach my $requestee (@needinfo_from_list) { + my $requestee_obj = Bugzilla::User->check($requestee); + $requestees{$requestee_obj->login} = 1; + } } # Find out if the requestee has already been used and skip if so my $requestee_found; foreach my $flag (@{ $type->{flags} }) { - if ((!$flag->requestee && !exists $needinfo_flag->{requestee}) - || ($flag->requestee && exists $needinfo_flag->{requestee} - && $flag->requestee->login eq $needinfo_flag->{requestee})) - { - $requestee_found = 1; - last; + if (!$flag->requestee && $requestees{'anyone'}) { + delete $requestees{'anyone'}; + } + if ($flag->requestee && $requestees{$flag->requestee->login}) { + delete $requestees{$flag->requestee->login}; } } - next if $requestee_found; - if ($needinfo) { + foreach my $requestee (keys %requestees) { + my $needinfo_flag = { type_id => $type->id, status => '?' }; + if ($requestee ne 'anyone') { + $needinfo_flag->{requestee} = $requestee; + } push(@new_flags, $needinfo_flag); - last; } } } diff --git a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl index 6031d6e0c..f56f8490b 100644 --- a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl +++ b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl @@ -82,11 +82,13 @@ - [%+ INCLUDE global/userselect.html.tmpl - id => "needinfo_from" - name => "needinfo_from" - size => 30 - value => "" + [% INCLUDE global/userselect.html.tmpl + id => "needinfo_from" + name => "needinfo_from" + value => "" + size => 30 + multiple => 5 + field_title => "Enter one or more comma separated users to request more information from" %] -- cgit v1.2.3-24-g4f1b