summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-10-14 03:58:37 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-10-14 03:58:49 +0200
commitcc3141625e4c87387259c38e4ab5f56820621768 (patch)
tree56f1fca73b16c7381c5dd91919d1030d66caf49b /Bugzilla/Bug.pm
parent4337c8d79654e4e16696c6ff567f8cc61276bbde (diff)
downloadbugzilla-cc3141625e4c87387259c38e4ab5f56820621768.tar.gz
bugzilla-cc3141625e4c87387259c38e4ab5f56820621768.tar.xz
Bug 1309487 - include longdescs.count in result for /rest/bug
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 77d2e126a..69734e6c0 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -265,6 +265,7 @@ use constant FIELD_MAP => {
is_cc_accessible => 'cclist_accessible',
is_creator_accessible => 'reporter_accessible',
last_change_time => 'delta_ts',
+ comment_count => 'longdescs.count',
platform => 'rep_platform',
severity => 'bug_severity',
status => 'bug_status',
@@ -3661,6 +3662,17 @@ sub comments {
return \@comments;
}
+sub comment_count {
+ my ($self) = @_;
+ return $self->{comment_count} if $self->{comment_count};
+ my $dbh = Bugzilla->dbh;
+ return $self->{comment_count} =
+ $dbh->selectrow_array('SELECT COUNT(longdescs.comment_id)
+ FROM longdescs
+ WHERE longdescs.bug_id = ?',
+ undef, $self->id);
+}
+
# This is needed by xt/search.t.
sub percentage_complete {
my $self = shift;