diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-11-15 23:36:37 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-11-15 23:36:37 +0100 |
commit | 1f6ff3a1a2b5f646de1b595b189865f7e586f39d (patch) | |
tree | 2265ad9da5054239198a63e95c6d2719692c352d /extensions/Ember | |
parent | cc05e9ef8c0423791ac1c885a7fb7073a21e4e0c (diff) | |
download | bugzilla-1f6ff3a1a2b5f646de1b595b189865f7e586f39d.tar.gz bugzilla-1f6ff3a1a2b5f646de1b595b189865f7e586f39d.tar.xz |
Bug 932034 - Ember.show API doesn't return can_edit property for dupe_of, blocks, and depends on fields
Diffstat (limited to 'extensions/Ember')
-rw-r--r-- | extensions/Ember/lib/WebService.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/extensions/Ember/lib/WebService.pm b/extensions/Ember/lib/WebService.pm index 38ebfa707..278b56fd4 100644 --- a/extensions/Ember/lib/WebService.pm +++ b/extensions/Ember/lib/WebService.pm @@ -217,6 +217,8 @@ sub show { name => $key, current_value => $bug_hash->{$key} }; + my $name = Bugzilla::Bug::FIELD_MAP()->{$key} || $key; + $field->{can_edit} = $self->_can_change_field($name, $bug); push(@fields, $field); } } @@ -503,20 +505,21 @@ sub _get_field_values { sub _can_change_field { my ($self, $field, $bug, $value) = @_; my $user = Bugzilla->user; + my $field_name = blessed $field ? $field->name : $field; # Cannot set resolution on bug creation - return $self->type('boolean', 0) if ($field->name eq 'resolution' && !$bug->{bug_id}); + return $self->type('boolean', 0) if ($field_name eq 'resolution' && !$bug->{bug_id}); # Cannot edit an obsolete or inactive custom field - return $self->type('boolean', 0) if ($field->custom && $field->obsolete); + return $self->type('boolean', 0) if (blessed $field && $field->custom && $field->obsolete); # If not a multi-select or single-select, value is not provided # and we just check if the field itself is editable by the user. if (!defined $value) { - return $self->type('boolean', $bug->check_can_change_field($field->name, 1, 0)); + return $self->type('boolean', $bug->check_can_change_field($field_name, 0, 1)); } - return $self->type('boolean', $bug->check_can_change_field($field->name, '', $value)); + return $self->type('boolean', $bug->check_can_change_field($field_name, '', $value)); } sub _flag_to_hash { |