summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-05-11 17:30:39 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-05-11 17:30:39 +0200
commitb34fcddb0e8c135d4f2feb9686223fddd9a8e7df (patch)
treeab93e96fe4404d7e31e76acaf7c2ddbeb1fcd471 /Bugzilla/WebService
parent1ad9a822d2aef528dd41605e4f36c044ce083d50 (diff)
downloadbugzilla-b34fcddb0e8c135d4f2feb9686223fddd9a8e7df.tar.gz
bugzilla-b34fcddb0e8c135d4f2feb9686223fddd9a8e7df.tar.xz
Bug 1161716: backport bug 1140575 to allow adding comment tags via webservice API when creating/updating
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Bug.pm47
1 files changed, 30 insertions, 17 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index b76c30b19..2edd2f3d0 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -1044,7 +1044,7 @@ sub update_attachment {
sub add_comment {
my ($self, $params) = @_;
-
+
# BMO: Don't allow updating of bugs if disabled
if (Bugzilla->params->{disable_bug_updates}) {
ThrowErrorPage('bug/process/updates-disabled.html.tmpl',
@@ -1053,42 +1053,46 @@ sub add_comment {
#The user must login in order add a comment
Bugzilla->login(LOGIN_REQUIRED);
-
+
# Check parameters
- defined $params->{id}
- || ThrowCodeError('param_required', { param => 'id' });
- my $comment = $params->{comment};
+ defined $params->{id}
+ || ThrowCodeError('param_required', { param => 'id' });
+ my $comment = $params->{comment};
(defined $comment && trim($comment) ne '')
|| ThrowCodeError('param_required', { param => 'comment' });
-
+
my $bug = Bugzilla::Bug->check($params->{id});
-
+
Bugzilla->user->can_edit_product($bug->product_id)
|| ThrowUserError("product_edit_denied", {product => $bug->product});
-
- # Backwards-compatibility for versions before 3.6
+
+ # Backwards-compatibility for versions before 3.6
if (defined $params->{private}) {
$params->{is_private} = delete $params->{private};
}
# Append comment
$bug->add_comment($comment, { isprivate => $params->{is_private},
work_time => $params->{work_time} });
-
- # Capture the call to bug->update (which creates the new comment) in
+
+ # Add comment tags
+ $bug->set_all({ comment_tags => $params->{comment_tags} })
+ if defined $params->{comment_tags};
+
+ # Capture the call to bug->update (which creates the new comment) in
# a transaction so we're sure to get the correct comment_id.
-
+
my $dbh = Bugzilla->dbh;
$dbh->bz_start_transaction();
-
+
$bug->update();
-
+
my $new_comment_id = $dbh->bz_last_key('longdescs', 'comment_id');
-
+
$dbh->bz_commit_transaction();
-
+
# Send mail.
Bugzilla::BugMail::Send($bug->bug_id, { changer => Bugzilla->user });
-
+
return { id => $self->type('int', $new_comment_id) };
}
@@ -3354,6 +3358,9 @@ don't want it to be assigned to the component owner.
=item C<comment_is_private> (boolean) - If set to true, the description
is private, otherwise it is assumed to be public.
+=item C<comment_tags> (array) - An array of strings to add as comment
+tags to the description.
+
=item C<groups> (array) - An array of group names to put this
bug into. You can see valid group names on the Permissions
tab of the Preferences screen, or, if you are an administrator,
@@ -3931,6 +3938,8 @@ otherwise it is assumed to be public.
on the bug. If you are not in the time tracking group, this value will
be ignored.
+=item C<comment_tags> (array) - Array of strings to add as comment tags for
+the new comment.
=back
@@ -4116,6 +4125,10 @@ The comment ids must be valid for the bug being updated. Thus, it is not
practical to use this while updating multiple bugs at once, as a single
comment id will never be valid on multiple bugs.
+=item C<comment_tags>
+
+C<array> An array of strings to add as comment tags for the new comment.
+
=item C<component>
C<string> The Component the bug is in.