From 71927e7ee069c33019780158670df2415ee1ef3b Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 31 Mar 2014 15:12:20 +0000 Subject: Bug 989650 - backport bug 294021 to bmo/4.2 to allow requestees to set attachment flags even if they don't have editbugs privs r=glob --- template/en/default/flag/list.html.tmpl | 38 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'template') diff --git a/template/en/default/flag/list.html.tmpl b/template/en/default/flag/list.html.tmpl index ecc919a38..0d84e9bff 100644 --- a/template/en/default/flag/list.html.tmpl +++ b/template/en/default/flag/list.html.tmpl @@ -18,7 +18,7 @@ # Contributor(s): Myk Melez #%] -[% IF user.id && !read_only_flags && (!bug || bug.check_can_change_field('flagtypes.name', 0, 1)) %] +[% IF user.id && (!bug || bug.check_can_change_field('flagtypes.name', 0, 1)) %] [%# We list flags by looping twice over the flag types relevant for the bug. # In the first loop, we display existing flags and then, for active types, @@ -53,7 +53,9 @@ [% FOREACH flag = type.flags %] [% PROCESS flag_row flag = flag type = type %] [% END -%] + [% SET flag = "" %] + [% NEXT IF read_only_flags %] [%-# Step 1b: Display UI for setting flag. %] [% IF (!type.flags || type.flags.size == 0) && type.is_active %] @@ -61,16 +63,18 @@ [% END %] [% END %] - [%# Step 2: Display flag type again (if type is multiplicable). %] - [% FOREACH type = flag_types %] - [% NEXT UNLESS type.flags && type.flags.size > 0 && type.is_multiplicable && type.is_active %] - [% IF !separator_displayed %] - -
- - [% separator_displayed = 1 %] + [% IF !read_only_flags %] + [%# Step 2: Display flag type again (if type is multiplicable). %] + [% FOREACH type = flag_types %] + [% NEXT UNLESS type.flags && type.flags.size > 0 && type.is_multiplicable && type.is_active %] + [% IF !separator_displayed %] + +
+ + [% separator_displayed = 1 %] + [% END %] + [% PROCESS flag_row type = type addl_text = "addl." %] [% END %] - [% PROCESS flag_row type = type addl_text = "addl." %] [% END %] @@ -104,6 +108,7 @@ [% BLOCK flag_row %] [% SET fid = flag ? "flag-$flag.id" : "flag_type-$type.id" %] + [% can_edit_flag = (!read_only_flags || (flag && (flag.setter_id == user.id || (flag.requestee_id && flag.requestee_id == user.id)))) ? 1 : 0 %] @@ -125,12 +130,13 @@ [% END %] title="[% type.description FILTER html %]" onchange="toggleRequesteeField(this);" - class="flag_select flag_type-[% type.id %]"> + class="flag_select flag_type-[% type.id %]" + [% IF !can_edit_flag %] disabled="disabled"[% END %]> [%# Only display statuses the user is allowed to set. %] - [% IF !flag || user.can_request_flag(type) || flag.setter_id == user.id %] + [% IF !flag || (can_edit_flag && user.can_request_flag(type)) || flag.setter_id == user.id %] [% END %] - [% IF type.is_active %] + [% IF type.is_active && can_edit_flag %] [% IF (type.is_requestable && user.can_request_flag(type)) || (flag && flag.status == "?") %] [% END %] @@ -151,12 +157,13 @@ [% SET grant_list = [] %] [% IF Param('usemenuforusers') %] - [% grant_list = type.grant_list %] - [% IF flag && !(type.is_active && type.is_requestable && type.is_requesteeble) %] + [% IF !can_edit_flag || (flag && !(type.is_active && type.is_requestable && type.is_requesteeble)) %] [%# We are here only because there was already a requestee. In this case, the only valid action is to remove the requestee or leave it alone; nothing else. %] [% grant_list = [flag.requestee] %] + [% ELSE %] + [% grant_list = type.grant_list %] [% END %] [% END %] [% SET flag_name = flag ? "requestee-$flag.id" : "requestee_type-$type.id" %] @@ -171,6 +178,7 @@ emptyok => flag_empty_ok classes => ["requestee"] custom_userlist => grant_list + disabled => !can_edit_flag %] [% Hook.process("requestee", "flag/list.html.tmpl") %] -- cgit v1.2.3-24-g4f1b