summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BMO/Extension.pm12
-rw-r--r--extensions/BMO/lib/Data.pm5
-rw-r--r--extensions/BugModal/lib/WebService.pm11
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl9
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/field.html.tmpl1
5 files changed, 32 insertions, 6 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 6938eb790..16caecc9a 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -549,8 +549,18 @@ sub bug_check_can_change_field {
my $user = Bugzilla->user;
if ($field =~ /^cf/ && !@$priv_results && $new_value ne '---') {
+ # Cannot use the standard %cf_setter mapping as we want anyone
+ # to be able to set ?, just not the other values.
+ if ($field eq 'cf_cab_review') {
+ if ($new_value ne '1'
+ && $new_value ne '?'
+ && !$user->in_group('infra', $bug->product_id))
+ {
+ push (@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED);
+ }
+ }
# "other" custom field setters restrictions
- if (exists $cf_setters->{$field}) {
+ elsif (exists $cf_setters->{$field}) {
my $in_group = 0;
foreach my $group (@{$cf_setters->{$field}}) {
if ($user->in_group($group, $bug->product_id)) {
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index ab9c15353..d5a87b50a 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -144,6 +144,11 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Firefox" => [],
"Toolkit" => [],
},
+ qr/^cf_cab_review$/ => {
+ "Developer Services" => [],
+ "Infrastructure & Operations Graveyard" => [],
+ "Infrastructure & Operations" => [],
+ }
);
# Who to CC on particular bugmails when certain groups are added or removed.
diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm
index e85225f60..7a05f263b 100644
--- a/extensions/BugModal/lib/WebService.pm
+++ b/extensions/BugModal/lib/WebService.pm
@@ -91,11 +91,12 @@ sub edit {
Bugzilla->active_custom_fields({ product => $bug->product_obj, component => $bug->component_obj });
foreach my $field (@custom_fields) {
my $field_name = $field->name;
- $options{$field_name} = [
- map { { name => $_->name } }
- grep { $bug->$field_name eq $_->name || $_->is_active }
- @{ $field->legal_values }
- ];
+ my @values = map { { name => $_->name } }
+ grep { $bug->$field_name eq $_->name
+ || ($_->is_active
+ && $bug->check_can_change_field($field_name, $bug->$field_name, $_->name)) }
+ @{ $field->legal_values };
+ $options{$field_name} = \@values;
}
# keywords
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 eca6f5805..b8c86194c 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -736,6 +736,15 @@
%]
[% END %]
+ [% UNLESS cf_hidden_in_product('cf_cab_review', bug.product, bug.component, bug) %]
+ [% rendered_custom_fields.push('cf_cab_review') %]
+ [% INCLUDE bug_modal/field.html.tmpl
+ field = bug_fields.cf_cab_review
+ field_type = bug_fields.cf_cab_review.type
+ hide_on_view = bug.cf_cab_review == "---"
+ %]
+ [% END %]
+
[% END %]
[% WRAPPER fields_rhs %]
diff --git a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
index 0c2f59cb0..bbc7dbb00 100644
--- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
@@ -173,6 +173,7 @@ END;
[% IF values.defined %]
[% FOREACH v IN values %]
[% NEXT IF NOT v.is_active AND NOT value.contains(v.name).size %]
+ [% NEXT IF NOT bug.check_can_change_field(name, bug.${name}, v.name) %]
<option value="[% v.name FILTER html %]"
id="v[% v.id FILTER html %]_[% name FILTER html %]"
[% " selected" IF value.contains(v.name).size %]