mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
Removed deleted and hidden comments from the comment count
refs https://github.com/TryGhost/Team/issues/1763 These should not be included in the count as they do not contain content.
This commit is contained in:
parent
fd9e19ce07
commit
43d41e8b0e
@ -11,6 +11,7 @@ module.exports = class CommentsStatsService {
|
||||
const results = await this.db.knex('comments')
|
||||
.select(this.db.knex.raw(`COUNT(*) AS count, post_id`))
|
||||
.groupBy('post_id')
|
||||
.where('status', 'published')
|
||||
.whereIn('post_id', ids);
|
||||
|
||||
const counts = ids.reduce((memo, id) => {
|
||||
@ -30,6 +31,7 @@ module.exports = class CommentsStatsService {
|
||||
async getAllCounts() {
|
||||
const results = await this.db.knex('comments')
|
||||
.select(this.db.knex.raw(`COUNT(*) AS count, post_id`))
|
||||
.where('status', 'published')
|
||||
.groupBy('post_id');
|
||||
|
||||
/** @type Object<string, number> */
|
||||
|
Loading…
Reference in New Issue
Block a user