summaryrefslogtreecommitdiffstats
path: root/extensions/Needinfo
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-04-23 17:40:29 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-04-23 17:40:29 +0200
commitca8762f064d4be411b72923354259013e2f0450f (patch)
tree8def71c6c7d7d38cf4086899335b0dfa9aefa42a /extensions/Needinfo
parent6666f8768bbab2105261beff6fdebf4de4dfd9a0 (diff)
downloadbugzilla-ca8762f064d4be411b72923354259013e2f0450f.tar.gz
bugzilla-ca8762f064d4be411b72923354259013e2f0450f.tar.xz
Bug 864304 - Requesting needinfo from more than one person is annoying
Diffstat (limited to 'extensions/Needinfo')
-rw-r--r--extensions/Needinfo/Extension.pm45
-rw-r--r--extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl12
2 files changed, 34 insertions, 23 deletions
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 @@
<option value="other">other</option>
</select>
<span id="needinfo_from_container" class="bz_default_hidden">
- [%+ 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"
%]
</span>
</td>