From d447aed0cb1672f6c7e99bf98199278dea23702f Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 21 Apr 2016 12:50:14 +0800 Subject: Bug 1239838 - Don't see a way to redirect a needinfo request (in Experimental UI) --- extensions/Needinfo/Extension.pm | 14 + .../template/en/default/bug/needinfo.html.tmpl | 354 +++++++++++---------- .../en/default/hook/global/header-start.html.tmpl | 14 +- extensions/Needinfo/web/styles/needinfo.css | 9 + 4 files changed, 225 insertions(+), 166 deletions(-) (limited to 'extensions/Needinfo') diff --git a/extensions/Needinfo/Extension.pm b/extensions/Needinfo/Extension.pm index c1659a1eb..a85bad5c6 100644 --- a/extensions/Needinfo/Extension.pm +++ b/extensions/Needinfo/Extension.pm @@ -92,6 +92,7 @@ sub bug_start_of_update { my $add_needinfo = delete $params->{needinfo}; my $needinfo_from = delete $params->{needinfo_from}; my $needinfo_role = delete $params->{needinfo_role}; + my $is_redirect = delete $params->{needinfo_redirect}; my $is_private = $params->{'comment_is_private'}; my @needinfo_overrides; @@ -181,6 +182,19 @@ sub bug_start_of_update { } } + if ($is_redirect && scalar(@new_flags) == 1) { + # Find the current user's needinfo request + foreach my $flag (@{ $bug->flags }) { + next unless $flag->type->name eq 'needinfo' + && $flag->requestee + && $flag->requestee->id == $user->id; + # Setting the id on new_flag updates the existing flag instead of + # creating a new one. + $new_flags[0]->{id} = $flag->id; + last; + } + } + if (@flags || @new_flags) { $bug->set_flags(\@flags, \@new_flags); } diff --git a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl index 7e32509bf..f350fb7f5 100644 --- a/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl +++ b/extensions/Needinfo/template/en/default/bug/needinfo.html.tmpl @@ -35,173 +35,203 @@ END; END; END; + + RETURN UNLESS needinfo_flagtype; %] -[% IF needinfo_flagtype %] -
- [% IF needinfo_flags.size > 0 %] - [%# Displays NEEDINFO tag in bug header %] - - [% END %] - + + +
+
+ [% FOREACH flag = needinfo_flags %] + + [% IF !flag.requestee || flag.requestee.id == user.id%] + [%# needinfo from anyone or the current user %] - - [% END %] -
- - + - - - - [% INCLUDE global/userselect.html.tmpl - id => "needinfo_from" - name => "needinfo_from" - value => "" - size => 30 - multiple => 5 - onchange => "needinfo_other_changed()" - field_title => "Enter one or more comma separated users to request more information from" - %] - - +
-
-[% END %] + [% ELSIF user.in_group("canconfirm") || flag.setter_id == user.id %] + [%# needinfo targetted at someone else, but the user can clear %] + + + + + + + [% ELSE %] + [%# current user does not have permissions to clear needinfo %] +   + + Needinfo requested from [% flag.requestee.login FILTER html %]. + + [% END %] + + [% END %] + [% IF needinfo_flags.size == 0 || needinfo_flagtype.is_multiplicable %] + + + + + + + + + + [% INCLUDE global/userselect.html.tmpl + id => "needinfo_from" + name => "needinfo_from" + value => "" + size => 30 + multiple => 5 + onchange => "needinfo_from_changed()" + field_title => "Enter one or more comma separated users to request more information from" + %] + + + + + [% END %] + + diff --git a/extensions/Needinfo/template/en/default/hook/global/header-start.html.tmpl b/extensions/Needinfo/template/en/default/hook/global/header-start.html.tmpl index 7f2095e3d..0cca4b09a 100644 --- a/extensions/Needinfo/template/en/default/hook/global/header-start.html.tmpl +++ b/extensions/Needinfo/template/en/default/hook/global/header-start.html.tmpl @@ -6,7 +6,13 @@ # defined by the Mozilla Public License, v. 2.0. #%] -[% IF template.name == 'attachment/create.html.tmpl' - || template.name == 'attachment/edit.html.tmpl' %] - [% style_urls.push('extensions/Needinfo/web/styles/needinfo.css') %] -[% END %] +[% + IF template.name == 'attachment/create.html.tmpl' + || template.name == 'attachment/edit.html.tmpl' + || template.name == 'bug/show.html.tmpl' + || template.name == 'bug/show-modal.html.tmpl' + || template.name == 'bug/process/results.html.tmpl' + ; + style_urls.push('extensions/Needinfo/web/styles/needinfo.css'); + END; +%] diff --git a/extensions/Needinfo/web/styles/needinfo.css b/extensions/Needinfo/web/styles/needinfo.css index e375ba610..83ed6813f 100644 --- a/extensions/Needinfo/web/styles/needinfo.css +++ b/extensions/Needinfo/web/styles/needinfo.css @@ -8,3 +8,12 @@ #needinfo_container label { font-weight: normal !important; } + +.needinfo-cb-td { + text-align: center; + vertical-align: baseline; +} + +#needinfo_role_identity { + margin-left: 1em; +} -- cgit v1.2.3-24-g4f1b