summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Comment.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Comment.pm')
-rw-r--r--Bugzilla/Comment.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm
index e81819652..300357313 100644
--- a/Bugzilla/Comment.pm
+++ b/Bugzilla/Comment.pm
@@ -188,6 +188,22 @@ sub _check_type {
return $type;
}
+sub count {
+ my ($self) = @_;
+
+ return $self->{'count'} if defined $self->{'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);
+
+ return --$self->{'count'};
+}
+
1;
__END__
@@ -243,6 +259,10 @@ C<0> otherwise.
L<Bugzilla::User> who created the comment.
+=item C<count>
+
+C<int> The position this comment is located in the full list of comments for a bug starting from 0.
+
=item C<body_full>
=over
@@ -273,8 +293,6 @@ A string, the full text of the comment as it would be displayed to an end-user.
=back
-
-
=back
=cut