From 4dbea14802e08bce7b62f45055a6fa8fdf3d92e1 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 25 Mar 2015 12:46:32 +0800 Subject: Bug 1147267: the firefox "iteration" and "points" fields are visible on all products --- extensions/BMO/Extension.pm | 8 +++++++- extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'extensions') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 03adcac33..52bdd53bc 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -343,7 +343,13 @@ sub active_custom_fields { } sub cf_hidden_in_product { - my ($field_name, $product_name, $component_name) = @_; + my ($field_name, $product_name, $component_name, $bug) = @_; + + # check bugzilla's built-in visibility controls first + if ($bug) { + my $field = Bugzilla::Field->new({ name => $field_name, cache => 1 }); + return 1 if $field && !$field->is_visible_on_bug($bug); + } # If used in buglist.cgi, we pass in one_product which is a Bugzilla::Product # elsewhere, we just pass the name of the product. diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index a16bfdd9b..a5d5f09f8 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -296,7 +296,7 @@ field_type = constants.FIELD_TYPE_SINGLE_SELECT inline = 1 %] - [% UNLESS cf_hidden_in_product('cf_rank', bug.product, bug.component) %] + [% UNLESS cf_hidden_in_product('cf_rank', bug.product, bug.component, bug) %] [% rendered_custom_fields.push('cf_rank') %] [% INCLUDE bug_modal/field.html.tmpl field = bug_fields.cf_rank @@ -569,7 +569,7 @@ [% bug.keyword_objects.pluck("name").join(", ") FILTER html %] [% END %] - [% UNLESS cf_hidden_in_product('cf_fx_iteration', bug.product, bug.component) %] + [% UNLESS cf_hidden_in_product('cf_fx_iteration', bug.product, bug.component, bug) %] [% rendered_custom_fields.push('cf_fx_iteration') %] [% INCLUDE bug_modal/field.html.tmpl field = bug_fields.cf_fx_iteration @@ -578,7 +578,7 @@ %] [% END %] - [% UNLESS cf_hidden_in_product('cf_fx_points', bug.product, bug.component) %] + [% UNLESS cf_hidden_in_product('cf_fx_points', bug.product, bug.component, bug) %] [% rendered_custom_fields.push('cf_fx_points') %] [% INCLUDE bug_modal/field.html.tmpl field = bug_fields.cf_fx_points @@ -736,7 +736,7 @@ FOREACH field = custom_fields; NEXT IF field.type == constants.FIELD_TYPE_EXTENSION || field.type == constants.FIELD_TYPE_TEXTAREA; NEXT IF rendered_custom_fields.exists(field.name); - NEXT IF cf_hidden_in_product(field.name, bug.product, bug.component); + NEXT IF cf_hidden_in_product(field.name, bug.product, bug.component, bug); cf_value = bug.${field.name}; IF field.type == constants.FIELD_TYPE_SINGLE_SELECT; has_value = cf_value != "---"; -- cgit v1.2.3-24-g4f1b