Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
66b328c8
Commit
66b328c8
authored
Apr 14, 2012
by
Tiago Mello
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 616336: Add a Bug.update_tags WebService method to edit personal tags
r/a=LpSolit
parent
778ea7db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
1 deletion
+101
-1
Bug.pm
Bugzilla/WebService/Bug.pm
+101
-1
No files found.
Bugzilla/WebService/Bug.pm
View file @
66b328c8
...
@@ -18,7 +18,7 @@ use Bugzilla::WebService::Constants;
...
@@ -18,7 +18,7 @@ use Bugzilla::WebService::Constants;
use
Bugzilla::WebService::
Util
qw(filter filter_wants validate)
;
use
Bugzilla::WebService::
Util
qw(filter filter_wants validate)
;
use
Bugzilla::
Bug
;
use
Bugzilla::
Bug
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
Util
qw(trick_taint trim)
;
use
Bugzilla::
Util
qw(trick_taint trim
diff_arrays
)
;
use
Bugzilla::
Version
;
use
Bugzilla::
Version
;
use
Bugzilla::
Milestone
;
use
Bugzilla::
Milestone
;
use
Bugzilla::
Status
;
use
Bugzilla::
Status
;
...
@@ -784,6 +784,44 @@ sub attachments {
...
@@ -784,6 +784,44 @@ sub attachments {
return
{
bugs
=>
\%
bugs
,
attachments
=>
\%
attachments
};
return
{
bugs
=>
\%
bugs
,
attachments
=>
\%
attachments
};
}
}
sub
update_tags
{
my
(
$self
,
$params
)
=
@_
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
my
$ids
=
$params
->
{
ids
};
my
$tags
=
$params
->
{
tags
};
ThrowCodeError
(
'param_required'
,
{
function
=>
'Bug.update_tags'
,
param
=>
'ids'
})
if
!
defined
$ids
;
ThrowCodeError
(
'param_required'
,
{
function
=>
'Bug.update_tags'
,
param
=>
'tags'
})
if
!
defined
$tags
;
my
%
changes
;
foreach
my
$bug_id
(
@$ids
)
{
my
$bug
=
Bugzilla::
Bug
->
check
(
$bug_id
);
my
@old_tags
=
@
{
$bug
->
tags
};
$bug
->
remove_tag
(
$_
)
foreach
@
{
$tags
->
{
remove
}
||
[]
};
$bug
->
add_tag
(
$_
)
foreach
@
{
$tags
->
{
add
}
||
[]
};
my
(
$removed
,
$added
)
=
diff_arrays
(
\
@old_tags
,
$bug
->
tags
);
my
@removed
=
map
{
$self
->
type
(
'string'
,
$_
)
}
@$removed
;
my
@added
=
map
{
$self
->
type
(
'string'
,
$_
)
}
@$added
;
$changes
{
$bug
->
id
}
->
{
tags
}
=
{
removed
=>
\
@removed
,
added
=>
\
@added
};
}
return
{
changes
=>
\%
changes
};
}
##############################
##############################
# Private Helper Subroutines #
# Private Helper Subroutines #
##############################
##############################
...
@@ -3267,3 +3305,65 @@ this bug.
...
@@ -3267,3 +3305,65 @@ this bug.
=back
=back
=back
=back
=head2 update_tags
B<UNSTABLE>
=item B<Description>
Adds or removes tags on bugs.
=item B<Params>
=over
=item C<ids>
B<Required> C<array> An array of ints and/or strings--the ids
or aliases of bugs that you want to add or remove tags to. All the tags
will be added or removed to all these bugs.
=item C<tags>
B<Required> C<hash> A hash representing tags to be added and/or removed.
The hash has the following fields:
=over
=item C<add> An array of C<string>s representing tag names
to be added to the bugs.
It is safe to specify tags that are already associated with the
bugs--they will just be silently ignored.
=item C<remove> An array of C<string>s representing tag names
to be removed from the bugs.
It is safe to specify tags that are not associated with any
bugs--they will just be silently ignored.
=back
=item B<Returns>
C<changes>, a hash containing bug IDs as keys and one single value
name "tags" which is also a hash, with C<added> and C<removed> as keys.
See L</update_see_also> for an example of how it looks like.
=item B<Errors>
This method can throw the same errors as L</get>.
=back
=item B<History>
=over
=item Added in Bugzilla B<4.4>.
=back
=back
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment