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
f805627e
Commit
f805627e
authored
May 11, 2015
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1140575: Comment-creation WebService API should allow tags to be specified
r=glob,a=glob
parent
e4362dad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
18 deletions
+50
-18
Bug.pm
Bugzilla/API/1_0/Resource/Bug.pm
+5
-0
Bug.pm
Bugzilla/Bug.pm
+22
-2
bug.rst
docs/en/rst/api/core/v1/bug.rst
+4
-0
comment.rst
docs/en/rst/api/core/v1/comment.rst
+19
-16
No files found.
Bugzilla/API/1_0/Resource/Bug.pm
View file @
f805627e
...
@@ -1154,6 +1154,11 @@ sub add_comment {
...
@@ -1154,6 +1154,11 @@ sub add_comment {
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
is_markdown
=>
$params
->
{
is_markdown
},
is_markdown
=>
$params
->
{
is_markdown
},
work_time
=>
$params
->
{
work_time
}
});
work_time
=>
$params
->
{
work_time
}
});
# Add comment tags
$bug
->
set_all
({
comment_tags
=>
$params
->
{
comment_tags
}
})
if
defined
$params
->
{
comment_tags
};
$bug
->
update
();
$bug
->
update
();
my
$new_comment_id
=
$bug
->
{
added_comments
}[
0
]
->
id
;
my
$new_comment_id
=
$bug
->
{
added_comments
}[
0
]
->
id
;
...
...
Bugzilla/Bug.pm
View file @
f805627e
...
@@ -720,6 +720,7 @@ sub create {
...
@@ -720,6 +720,7 @@ sub create {
my
$creation_comment
=
delete
$params
->
{
comment
};
my
$creation_comment
=
delete
$params
->
{
comment
};
my
$is_markdown
=
delete
$params
->
{
is_markdown
};
my
$is_markdown
=
delete
$params
->
{
is_markdown
};
my
$see_also
=
delete
$params
->
{
see_also
};
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
# We don't want the bug to appear in the system until it's correctly
# protected by groups.
# protected by groups.
...
@@ -810,7 +811,16 @@ sub create {
...
@@ -810,7 +811,16 @@ sub create {
# Insert the comment. We always insert a comment on bug creation,
# Insert the comment. We always insert a comment on bug creation,
# but sometimes it's blank.
# 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
# Set up aliases
my
$sth_aliases
=
$dbh
->
prepare
(
'INSERT INTO bugs_aliases (alias, bug_id) VALUES (?, ?)'
);
my
$sth_aliases
=
$dbh
->
prepare
(
'INSERT INTO bugs_aliases (alias, bug_id) VALUES (?, ?)'
);
...
@@ -1039,7 +1049,7 @@ sub update {
...
@@ -1039,7 +1049,7 @@ sub update {
join
(
', '
,
@added_names
)];
join
(
', '
,
@added_names
)];
}
}
# Comments
# Comments
and comment tags
foreach
my
$comment
(
@
{
$self
->
{
added_comments
}
||
[]
})
{
foreach
my
$comment
(
@
{
$self
->
{
added_comments
}
||
[]
})
{
# Override the Comment's timestamp to be identical to the update
# Override the Comment's timestamp to be identical to the update
# timestamp.
# timestamp.
...
@@ -1049,6 +1059,10 @@ sub update {
...
@@ -1049,6 +1059,10 @@ sub update {
LogActivityEntry
(
$self
->
id
,
"work_time"
,
""
,
$comment
->
work_time
,
LogActivityEntry
(
$self
->
id
,
"work_time"
,
""
,
$comment
->
work_time
,
$user
->
id
,
$delta_ts
);
$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
# Comment Privacy
...
@@ -2459,6 +2473,12 @@ sub set_all {
...
@@ -2459,6 +2473,12 @@ sub set_all {
is_markdown
=>
$params
->
{
'comment'
}
->
{
'is_markdown'
}
});
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
})
{
if
(
exists
$params
->
{
alias
}
&&
$params
->
{
alias
}{
set
})
{
$params
->
{
alias
}
=
{
$params
->
{
alias
}
=
{
add
=>
$params
->
{
alias
}{
set
},
add
=>
$params
->
{
alias
}{
set
},
...
...
docs/en/rst/api/core/v1/bug.rst
View file @
f805627e
...
@@ -593,6 +593,8 @@ assigned_to string A user to assign this bug to, if you don't want it
...
@@ -593,6 +593,8 @@ assigned_to string A user to assign this bug to, if you don't want it
cc array An array of usernames to CC on this bug.
cc array An array of usernames to CC on this bug.
comment_is_private boolean If set to ``true``, the description is private,
comment_is_private boolean If set to ``true``, the description is private,
otherwise it is assumed to be public.
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
is_markdown boolean If set to ``true``, the description has Markdown
structures; otherwise it is normal text.
structures; otherwise it is normal text.
groups array An array of group names to put this bug into. You
groups array An array of group names to put this bug into. You
...
@@ -780,6 +782,8 @@ comment_is_private object This is how you update the privacy of comments
...
@@ -780,6 +782,8 @@ comment_is_private object This is how you update the privacy of comments
updated. Thus, it is not practical to use this
updated. Thus, it is not practical to use this
while updating multiple bugs at once, as a single
while updating multiple bugs at once, as a single
comment ID will never be valid on multiple bugs.
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.
component string The Component the bug is in.
deadline date The Deadline field is a date specifying when the
deadline date The Deadline field is a date specifying when the
bug must be completed by, in the format
bug must be completed by, in the format
...
...
docs/en/rst/api/core/v1/comment.rst
View file @
f805627e
...
@@ -105,6 +105,7 @@ is_private boolean ``true`` if this comment is private (only visible to a
...
@@ -105,6 +105,7 @@ is_private boolean ``true`` if this comment is private (only visible to a
otherwise.
otherwise.
is_markdown boolean ``true`` if this comment needs Markdown processing;
is_markdown boolean ``true`` if this comment needs Markdown processing;
``false`` otherwise.
``false`` otherwise.
tags array An array of comment tags currently set for the comment.
============= ======== ========================================================
============= ======== ========================================================
.. _rest_add_comment:
.. _rest_add_comment:
...
@@ -134,22 +135,24 @@ To create a comment on a current bug.
...
@@ -134,22 +135,24 @@ To create a comment on a current bug.
``ids`` is optional in the data example above and can be used to specify adding
``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.
a comment to more than one bug at the same time.
=========== ======= ===========================================================
============ ======= ===========================================================
name type description
name type description
=========== ======= ===========================================================
============ ======= ===========================================================
**id** int The ID or alias of the bug to append a comment to.
**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.
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
**comment** string The comment to append to the bug. If this is empty
or all whitespace, an error will be thrown saying that you
or all whitespace, an error will be thrown saying that you
did not set the ``comment`` parameter.
did not set the ``comment`` parameter.
is_private boolean If set to ``true``, the comment is private, otherwise it is
comment_tags array An array of strings to add as comment tags for the new
assumed to be public.
comment.
is_markdown boolean If set to ``true``, the comment has Markdown structures;
is_private boolean If set to ``true``, the comment is private, otherwise it is
otherwise it is normal text.
assumed to be public.
work_time double Adds this many hours to the "Hours Worked" on the bug.
is_markdown boolean If set to ``true``, the comment has Markdown structures;
If you are not in the time tracking group, this value will
otherwise it is normal text.
be ignored.
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**
**Response**
...
...
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