summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Classification.pm
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-04-28 16:19:54 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-04-28 16:19:54 +0200
commit96ff287433595d8fed8791af1ed0f6e382b3f4a9 (patch)
tree241ae7bb6b46f188821fb9b9beb549e2a377394e /Bugzilla/WebService/Classification.pm
parent40d80bae28d53965a0abc38ca465c8c986ad0aa3 (diff)
downloadbugzilla-96ff287433595d8fed8791af1ed0f6e382b3f4a9.tar.gz
bugzilla-96ff287433595d8fed8791af1ed0f6e382b3f4a9.tar.xz
Bug 1000913 - Backport upstream bug 540818 to bmo/4.2 to improve include_fields and exclude_fields to accept _default, _all and _custom keywords
r=glob
Diffstat (limited to 'Bugzilla/WebService/Classification.pm')
-rw-r--r--Bugzilla/WebService/Classification.pm22
1 files changed, 10 insertions, 12 deletions
diff --git a/Bugzilla/WebService/Classification.pm b/Bugzilla/WebService/Classification.pm
index 22358c784..1c4226fd6 100644
--- a/Bugzilla/WebService/Classification.pm
+++ b/Bugzilla/WebService/Classification.pm
@@ -41,39 +41,37 @@ sub get {
@classification_objs = grep { $selectable_class{$_->id} } @classification_objs;
}
- my @classifications = map { filter($params, $self->_classification_to_hash($_)) } @classification_objs;
+ my @classifications = map { $self->_classification_to_hash($_, $params) } @classification_objs;
return { classifications => \@classifications };
}
sub _classification_to_hash {
- my ($self, $classification) = @_;
+ my ($self, $classification, $params) = @_;
my $user = Bugzilla->user;
return unless (Bugzilla->params->{'useclassification'} || $user->in_group('editclassifications'));
my $products = $user->in_group('editclassifications') ?
$classification->products : $user->get_selectable_products($classification->id);
- my %hash = (
+
+ return filter $params, {
id => $self->type('int', $classification->id),
name => $self->type('string', $classification->name),
description => $self->type('string', $classification->description),
sort_key => $self->type('int', $classification->sortkey),
- products => [ map { $self->_product_to_hash($_) } @$products ],
- );
-
- return \%hash;
+ products => [ map { $self->_product_to_hash($_, $params) } @$products ],
+ };
}
sub _product_to_hash {
- my ($self, $product) = @_;
- my %hash = (
+ my ($self, $product, $params) = @_;
+
+ return filter $params, {
id => $self->type('int', $product->id),
name => $self->type('string', $product->name),
description => $self->type('string', $product->description),
- );
-
- return \%hash;
+ }, undef, 'products';
}
1;