]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1303659 - Bug.comments (/rest/bug/<id>/comment) should return the count value...
authorDavid Lawrence <dkl@mozilla.com>
Tue, 20 Sep 2016 13:48:07 +0000 (13:48 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Tue, 20 Sep 2016 13:48:07 +0000 (13:48 +0000)
Bugzilla/Comment.pm
Bugzilla/WebService/Bug.pm

index a8f915bfd28389f8bfa8cef5b837e26c60e035d4..7c2d5c4ea76266f798da27932f464ccb8e34e606 100644 (file)
@@ -468,12 +468,12 @@ sub count {
     my $dbh = Bugzilla->dbh;
     ($self->{'count'}) = $dbh->selectrow_array(
         "SELECT COUNT(*)
-           FROM longdescs 
-          WHERE bug_id = ? 
-                AND bug_when <= ?",
-        undef, $self->bug_id, $self->creation_ts);
+           FROM longdescs
+          WHERE bug_id = ?
+                AND comment_id < ?",
+        undef, $self->bug_id, $self->id);
 
-    return --$self->{'count'};
+    return $self->{'count'};
 }
 
 1;
index f9a91797e21d5ad9921a5fb6388afc990831b23e..20a21147d4efe43eec8a332f255d52474fea78bb 100644 (file)
@@ -388,6 +388,7 @@ sub _translate_comment {
         is_private => $self->type('boolean', $comment->is_private),
         text       => $self->type('string', $comment->body_full),
         attachment_id => $self->type('int', $attach_id),
+        count      => $self->type('int', $comment->count),
     };
 
     # Don't load comment tags unless enabled