]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1111043: Bug.add_comment returns the wrong comment ID
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 17 Dec 2014 19:40:54 +0000 (20:40 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 17 Dec 2014 19:40:54 +0000 (20:40 +0100)
r/a=dkl

Bugzilla/WebService/Bug.pm

index 7c28b1d8d03de5a381e09b5c9051ae7b519db8f9..45110cc670f48d16f04c0ab326717914c801702f 100644 (file)
@@ -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 });