Commit 0598a0af authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1111043: Bug.add_comment returns the wrong comment ID

r=dkl a=glob
parent 04fd938b
...@@ -981,18 +981,9 @@ sub add_comment { ...@@ -981,18 +981,9 @@ 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} });
# 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(); $bug->update();
my $new_comment_id = $dbh->bz_last_key('longdescs', 'comment_id'); my $new_comment_id = $bug->{added_comments}[0]->id;
$dbh->bz_commit_transaction();
# Send mail. # Send mail.
Bugzilla::BugMail::Send($bug->bug_id, { changer => $user }); Bugzilla::BugMail::Send($bug->bug_id, { changer => $user });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment