$bug->add_comment($comment, { isprivate => $params->{is_private},
is_markdown => $params->{is_markdown},
work_time => $params->{work_time} });
+
+ # Add comment tags
+ $bug->set_all({ comment_tags => $params->{comment_tags} })
+ if defined $params->{comment_tags};
+
$bug->update();
my $new_comment_id = $bug->{added_comments}[0]->id;
my $creation_comment = delete $params->{comment};
my $is_markdown = delete $params->{is_markdown};
my $see_also = delete $params->{see_also};
+ my $comment_tags = delete $params->{comment_tags};
# We don't want the bug to appear in the system until it's correctly
# protected by groups.
# Insert the comment. We always insert a comment on bug creation,
# but sometimes it's blank.
- Bugzilla::Comment->insert_create_data($creation_comment);
+ my $comment = Bugzilla::Comment->insert_create_data($creation_comment);
+
+ # Add comment tags
+ if (defined $comment_tags && Bugzilla->user->can_tag_comments) {
+ $comment_tags = ref $comment_tags ? $comment_tags : [ $comment_tags ];
+ foreach my $tag (@{$comment_tags}) {
+ $comment->add_tag($tag) if defined $tag;
+ }
+ $comment->update();
+ }
# Set up aliases
my $sth_aliases = $dbh->prepare('INSERT INTO bugs_aliases (alias, bug_id) VALUES (?, ?)');
join(', ', @added_names)];
}
- # Comments
+ # Comments and comment tags
foreach my $comment (@{$self->{added_comments} || []}) {
# Override the Comment's timestamp to be identical to the update
# timestamp.
LogActivityEntry($self->id, "work_time", "", $comment->work_time,
$user->id, $delta_ts);
}
+ foreach my $tag (@{$self->{added_comment_tags} || []}) {
+ $comment->add_tag($tag) if defined $tag;
+ }
+ $comment->update() if @{$self->{added_comment_tags} || []};
}
# Comment Privacy
is_markdown => $params->{'comment'}->{'is_markdown'} });
}
+ if (defined $params->{comment_tags} && Bugzilla->user->can_tag_comments()) {
+ $self->{added_comment_tags} = ref $params->{comment_tags}
+ ? $params->{comment_tags}
+ : [ $params->{comment_tags} ];
+ }
+
if (exists $params->{alias} && $params->{alias}{set}) {
$params->{alias} = {
add => $params->{alias}{set},
cc array An array of usernames to CC on this bug.
comment_is_private boolean If set to ``true``, the description is private,
otherwise it is assumed to be public.
+comment_tags array An array of strings to add as comment tags for the
+ description.
is_markdown boolean If set to ``true``, the description has Markdown
structures; otherwise it is normal text.
groups array An array of group names to put this bug into. You
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.
+comment_tags array An array of strings to add as comment tags for
+ the new comment.
component string The Component the bug is in.
deadline date The Deadline field is a date specifying when the
bug must be completed by, in the format
otherwise.
is_markdown boolean ``true`` if this comment needs Markdown processing;
``false`` otherwise.
+tags array An array of comment tags currently set for the comment.
============= ======== ========================================================
.. _rest_add_comment:
``ids`` is optional in the data example above and can be used to specify adding
a comment to more than one bug at the same time.
-=========== ======= ===========================================================
-name type description
-=========== ======= ===========================================================
-**id** int The ID or alias of the bug to append a comment to.
-ids array List of integer bug IDs to add the comment to.
-**comment** string The comment to append to the bug. If this is empty
- or all whitespace, an error will be thrown saying that you
- did not set the ``comment`` parameter.
-is_private boolean If set to ``true``, the comment is private, otherwise it is
- assumed to be public.
-is_markdown boolean If set to ``true``, the comment has Markdown structures;
- otherwise it is normal text.
-work_time double Adds this many hours to the "Hours Worked" on the bug.
- If you are not in the time tracking group, this value will
- be ignored.
-=========== ======= ===========================================================
+============ ======= ===========================================================
+name type description
+============ ======= ===========================================================
+**id** int The ID or alias of the bug to append a comment to.
+ids array List of integer bug IDs to add the comment to.
+**comment** string The comment to append to the bug. If this is empty
+ or all whitespace, an error will be thrown saying that you
+ did not set the ``comment`` parameter.
+comment_tags array An array of strings to add as comment tags for the new
+ comment.
+is_private boolean If set to ``true``, the comment is private, otherwise it is
+ assumed to be public.
+is_markdown boolean If set to ``true``, the comment has Markdown structures;
+ otherwise it is normal text.
+work_time double Adds this many hours to the "Hours Worked" on the bug.
+ If you are not in the time tracking group, this value will
+ be ignored.
+============ ======= ===========================================================
**Response**