From c233b6940ff5dcfde22d3857ae6c334ff0904d83 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Thu, 15 Nov 2012 14:04:42 +0800 Subject: Bug 809198: Enable multiple needinfo flags on a single bug --- extensions/Needinfo/Extension.pm | 11 ++-- .../template/en/default/bug/needinfo.html.tmpl | 61 +++++++++++----------- 2 files changed, 38 insertions(+), 34 deletions(-) (limited to 'extensions/Needinfo') diff --git a/extensions/Needinfo/Extension.pm b/extensions/Needinfo/Extension.pm index c48593cff..2958031be 100644 --- a/extensions/Needinfo/Extension.pm +++ b/extensions/Needinfo/Extension.pm @@ -73,9 +73,15 @@ sub bug_end_of_update { my $needinfo = delete $params->{needinfo}; my $needinfo_from = delete $params->{needinfo_from}; my $needinfo_role = delete $params->{needinfo_role}; - my $override = delete $params->{needinfo_override}; my $is_private = $params->{'comment_is_private'}; + my @needinfo_overrides; + foreach my $key (grep(/^needinfo_override_/, keys %$params)) { + my ($id) = $key =~ /(\d+)$/; + # Should always be true if key exists (checkbox) but better to be sure + push(@needinfo_overrides, $id) if $id && $params->{$key}; + } + # Set the needinfo flag if user is requesting more information my @new_flags; my $needinfo_requestee; @@ -83,7 +89,6 @@ sub bug_end_of_update { if ($user->in_group('canconfirm') && $needinfo) { foreach my $type (@{ $bug->flag_types }) { next if $type->name ne 'needinfo'; - next if @{ $type->{flags} }; my $needinfo_flag = { type_id => $type->id, status => '?' }; @@ -123,7 +128,7 @@ sub bug_end_of_update { $clear_needinfo = 1 if $flag->status ne '?'; # Clear if current user has selected override - $clear_needinfo = 1 if $override; + $clear_needinfo = 1 if grep($_ == $flag->id, @needinfo_overrides); # Clear if bug is being closed if (($bug->bug_status ne $old_bug->bug_status) diff --git a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl index d55f28157..db02df79b 100644 --- a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl +++ b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl @@ -6,29 +6,23 @@ # defined by the Mozilla Public License, v. 2.0. #%] -[% show_needinfo = 0 %] -[% needinfo_requested = 0 %] -[% needinfo_from = "" %] -[% needinfo_from_any = 0 %] -[% can_create_needinfo = 0 %] +[% needinfo_flagtype = "" %] +[% needinfo_flags = [] %] +[% can_create_needinfo = 0 %] [% FOREACH type = bug.flag_types %] [% IF type.name == 'needinfo' %] - [% show_needinfo = 1 %] + [% needinfo_flagtype = type %] [% FOREACH flag = type.flags %] [% IF flag.status == '?' %] - [% needinfo_requested = 1 %] - [% IF flag.requestee.login %] - [% needinfo_from = flag.requestee.login %] - [% ELSE %] - [% needinfo_from_any = 1 %] - [% END %] + [% needinfo_flags.push(flag) %] [% END %] [% END %] + [% LAST IF needinfo_flagtype %] [% END %] [% END %] -[% IF user.in_group('canconfirm') && !needinfo_requested %] +[% IF user.in_group('canconfirm') %] [% IF bug.status.is_open %] [% can_create_needinfo = 1 %] [% ELSE %] @@ -41,28 +35,32 @@ [% END %] [% END %] -[% IF show_needinfo %] - [%# Displays NEEDINFO tag in bug header %] - [% IF needinfo_requested %] - - [% END %] - +[% IF needinfo_flagtype %]
- [% IF needinfo_requested %] - [% IF needinfo_from == user.login || needinfo_from_any %] - Adding comment will automatically clear needinfo request. - [% ELSE %] - - + [% IF needinfo_flags.size > 0 %] + [%# Displays NEEDINFO tag in bug header %] + + + [% FOREACH flag = needinfo_flags %] + [% IF !flag.requestee || flag.requestee.id == user.id %] + Adding a comment will automatically clear needinfo the request for + [% IF !flag.requestee %]anyone[% ELSE %][% flag.requestee.login FILTER html %][% END %]. + [% ELSE %] + + + [% END %] +
[% END %] [% END %] - [% IF can_create_needinfo %] + [% IF can_create_needinfo && (needinfo_flags.size == 0 || needinfo_flagtype.is_multiplicable) %]