aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-01-20 20:26:16 +0000
committermkanat%bugzilla.org <>2009-01-20 20:26:16 +0000
commit4a2ceff53d05ed1a9440609c21e78364e8e8b020 (patch)
treeb2ad1f6178335f9cbb7ee454a0551bd2c8af49d0 /Bugzilla/WebService
parent2e920979ebe3ecead46c4b2982041fd86155a4dd (diff)
downloadbugs-4a2ceff53d05ed1a9440609c21e78364e8e8b020.tar
bugs-4a2ceff53d05ed1a9440609c21e78364e8e8b020.tar.gz
bugs-4a2ceff53d05ed1a9440609c21e78364e8e8b020.tar.bz2
bugs-4a2ceff53d05ed1a9440609c21e78364e8e8b020.tar.xz
bugs-4a2ceff53d05ed1a9440609c21e78364e8e8b020.zip
Bug 473052: Modify WebService::Bug.add_comment to return the new comment ID
Patch By Kip Hampton <khampton@totalcinema.com> r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla/WebService')
-rwxr-xr-xBugzilla/WebService/Bug.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 5626d1a84..715ebe833 100755
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -337,11 +337,23 @@ sub add_comment {
# Append comment
$bug->add_comment($comment, { isprivate => $params->{private},
work_time => $params->{work_time} });
+
+ # 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->login });
- return undef;
+
+ return { id => $self->type('int', $new_comment_id) };
}
1;
@@ -977,6 +989,10 @@ be ignored.
=back
+=item B<Returns>
+
+A hash with one element, C<id> whose value is the id of the newly-created comment.
+
=item B<Errors>
=over
@@ -1002,6 +1018,8 @@ You did not have the necessary rights to edit the bug.
=item Added in Bugzilla B<3.2>.
+=item Modified to return the new comment's id in Bugzilla B<3.4>
+
=back
=back