aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2014-12-17 20:40:54 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2014-12-17 20:40:54 +0100
commitc76e2cc13528d5e17214d20fc2475c1e5835e0ec (patch)
treee94cdbdd619d5b69297d87fcea53d331d777ffa8 /Bugzilla
parent707773ab84ff43fd755dd0a909b19fdca899760e (diff)
downloadbugs-c76e2cc13528d5e17214d20fc2475c1e5835e0ec.tar
bugs-c76e2cc13528d5e17214d20fc2475c1e5835e0ec.tar.gz
bugs-c76e2cc13528d5e17214d20fc2475c1e5835e0ec.tar.bz2
bugs-c76e2cc13528d5e17214d20fc2475c1e5835e0ec.tar.xz
bugs-c76e2cc13528d5e17214d20fc2475c1e5835e0ec.zip
Bug 1111043: Bug.add_comment returns the wrong comment ID
r/a=dkl
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/WebService/Bug.pm15
1 files changed, 3 insertions, 12 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 7c28b1d8d..45110cc67 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -952,19 +952,10 @@ sub add_comment {
# 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
- # 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();
-
+
+ my $new_comment_id = $bug->{added_comments}[0]->id;
+
# Send mail.
Bugzilla::BugMail::Send($bug->bug_id, { changer => $user });