Skip to content

Commit c76e2cc

Browse files
committed
Bug 1111043: Bug.add_comment returns the wrong comment ID
r/a=dkl
1 parent 707773a commit c76e2cc

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

Bugzilla/WebService/Bug.pm

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -952,19 +952,10 @@ sub add_comment {
952952
# Append comment
953953
$bug->add_comment($comment, { isprivate => $params->{is_private},
954954
work_time => $params->{work_time} });
955-
956-
# Capture the call to bug->update (which creates the new comment) in
957-
# a transaction so we're sure to get the correct comment_id.
958-
959-
my $dbh = Bugzilla->dbh;
960-
$dbh->bz_start_transaction();
961-
962955
$bug->update();
963-
964-
my $new_comment_id = $dbh->bz_last_key('longdescs', 'comment_id');
965-
966-
$dbh->bz_commit_transaction();
967-
956+
957+
my $new_comment_id = $bug->{added_comments}[0]->id;
958+
968959
# Send mail.
969960
Bugzilla::BugMail::Send($bug->bug_id, { changer => $user });
970961

0 commit comments

Comments
 (0)