summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Bug.pm
diff options
context:
space:
mode:
authorSimon Green <sgreen@redhat.com>2014-06-19 00:51:04 +0200
committerSimon Green <sgreen@redhat.com>2014-06-19 00:51:04 +0200
commit0898458132400dce4d9033487b1bde120762327e (patch)
tree11f148df11cec550a5a3f57c105dfe692eaa90f9 /Bugzilla/WebService/Bug.pm
parentd596739c558b305e07dc9d885fcca3a103bfbd67 (diff)
downloadbugzilla-0898458132400dce4d9033487b1bde120762327e.tar.gz
bugzilla-0898458132400dce4d9033487b1bde120762327e.tar.xz
Bug 1023725 - Rename Bug.flag_types webservice call to FlagType.get
r=glob, a=glob
Diffstat (limited to 'Bugzilla/WebService/Bug.pm')
-rw-r--r--Bugzilla/WebService/Bug.pm180
1 files changed, 0 insertions, 180 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 8bb43936b..a905d9526 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -1083,38 +1083,6 @@ sub update_tags {
return { changes => \%changes };
}
-sub flag_types {
- my ($self, $params) = @_;
- my $dbh = Bugzilla->switch_to_shadow_db();
- my $user = Bugzilla->user;
-
- defined $params->{product}
- || ThrowCodeError('param_required',
- { function => 'Bug.flag_types',
- param => 'product' });
-
- my $product = delete $params->{product};
- my $component = delete $params->{component};
-
- $product = Bugzilla::Product->check({ name => $product, cache => 1 });
- $component = Bugzilla::Component->check(
- { name => $component, product => $product, cache => 1 }) if $component;
-
- my $flag_params = { product_id => $product->id };
- $flag_params->{component_id} = $component->id if $component;
- my $matched_flag_types = Bugzilla::FlagType::match($flag_params);
-
- my $flag_types = { bug => [], attachment => [] };
- foreach my $flag_type (@$matched_flag_types) {
- push(@{ $flag_types->{bug} }, $self->_flagtype_to_hash($flag_type, $product))
- if $flag_type->target_type eq 'bug';
- push(@{ $flag_types->{attachment} }, $self->_flagtype_to_hash($flag_type, $product))
- if $flag_type->target_type eq 'attachment';
- }
-
- return $flag_types;
-}
-
sub update_comment_tags {
my ($self, $params) = @_;
@@ -1399,56 +1367,6 @@ sub _flag_to_hash {
return $item;
}
-sub _flagtype_to_hash {
- my ($self, $flagtype, $product) = @_;
- my $user = Bugzilla->user;
-
- my @values = ('X');
- push(@values, '?') if ($flagtype->is_requestable && $user->can_request_flag($flagtype));
- push(@values, '+', '-') if $user->can_set_flag($flagtype);
-
- my $item = {
- id => $self->type('int' , $flagtype->id),
- name => $self->type('string' , $flagtype->name),
- description => $self->type('string' , $flagtype->description),
- type => $self->type('string' , $flagtype->target_type),
- values => \@values,
- is_active => $self->type('boolean', $flagtype->is_active),
- is_requesteeble => $self->type('boolean', $flagtype->is_requesteeble),
- is_multiplicable => $self->type('boolean', $flagtype->is_multiplicable)
- };
-
- if ($product) {
- my $inclusions = $self->_flagtype_clusions_to_hash($flagtype->inclusions, $product->id);
- my $exclusions = $self->_flagtype_clusions_to_hash($flagtype->exclusions, $product->id);
- # if we have both inclusions and exclusions, the exclusions are redundant
- $exclusions = [] if @$inclusions && @$exclusions;
- # no need to return anything if there's just "any component"
- $item->{inclusions} = $inclusions if @$inclusions && $inclusions->[0] ne '';
- $item->{exclusions} = $exclusions if @$exclusions && $exclusions->[0] ne '';
- }
-
- return $item;
-}
-
-sub _flagtype_clusions_to_hash {
- my ($self, $clusions, $product_id) = @_;
- my $result = [];
- foreach my $key (keys %$clusions) {
- my ($prod_id, $comp_id) = split(/:/, $clusions->{$key}, 2);
- if ($prod_id == 0 || $prod_id == $product_id) {
- if ($comp_id) {
- my $component = Bugzilla::Component->new({ id => $comp_id, cache => 1 });
- push @$result, $component->name;
- }
- else {
- return [ '' ];
- }
- }
- }
- return $result;
-}
-
sub _add_update_tokens {
my ($self, $params, $bugs, $hashes) = @_;
@@ -1718,104 +1636,6 @@ You specified an invalid field name or id.
=back
-=head2 flag_types
-
-B<UNSTABLE>
-
-=over
-
-=item B<Description>
-
-Get information about valid flag types that can be set for bugs and attachments.
-
-=item B<REST>
-
-You have several options for retreiving information about flag types. The first
-part is the request method and the rest is the related path needed.
-
-To get information about all flag types for a product:
-
-GET /rest/flag_types/<product>
-
-To get information about flag_types for a product and component:
-
-GET /rest/flag_types/<product>/<component>
-
-The returned data format is the same as below.
-
-=item B<Params>
-
-You must pass a product name and an optional component name.
-
-=over
-
-=item C<product> (string) - The name of a valid product.
-
-=item C<component> (string) - An optional valid component name associated with the product.
-
-=back
-
-=item B<Returns>
-
-A hash containing two keys, C<bug> and C<attachment>. Each key value is an array of hashes,
-containing the following keys:
-
-=over
-
-=item C<id>
-
-C<int> An integer id uniquely identifying this flag type.
-
-=item C<name>
-
-C<string> The name for the flag type.
-
-=item C<type>
-
-C<string> The target of the flag type which is either C<bug> or C<attachment>.
-
-=item C<description>
-
-C<string> The description of the flag type.
-
-=item C<values>
-
-C<array> An array of string values that the user can set on the flag type.
-
-=item C<is_requesteeble>
-
-C<boolean> Users can ask specific other users to set flags of this type.
-
-=item C<is_multiplicable>
-
-C<boolean> Multiple flags of this type can be set for the same bug or attachment.
-
-=back
-
-=item B<Errors>
-
-=over
-
-=item 106 (Product Access Denied)
-
-Either the product does not exist or you don't have access to it.
-
-=item 51 (Invalid Component)
-
-The component provided does not exist in the product.
-
-=back
-
-=item B<History>
-
-=over
-
-=item Added in Bugzilla B<5.0>.
-
-=back
-
-=back
-
=head2 legal_values
B<DEPRECATED> - Use L</fields> instead.