ActivityPub-federated video streaming platform using P2P directly in your web browser
Don't count deleted comment for replies
Chocobozzz99cb53fd5af3
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.tsindex bdf5d86bcd..e1faf2b9ac 100644--- a/server/models/video/video-comment.ts+++ b/server/models/video/video-comment.ts@@ -69,14 +69,10 @@ export enum ScopeNames {Sequelize.literal('(' +'WITH "blocklist" AS (' + buildBlockedAccountSQL(blockerAccountIds) + ')' +- 'SELECT COUNT("replies"."id") - (' +- 'SELECT COUNT("replies"."id") ' +- 'FROM "videoComment" AS "replies" ' +- 'WHERE "replies"."originCommentId" = "VideoCommentModel"."id" ' +- 'AND "accountId" IN (SELECT "id" FROM "blocklist")' +- ')' ++ 'SELECT COUNT("replies"."id") ' +'FROM "videoComment" AS "replies" ' +'WHERE "replies"."originCommentId" = "VideoCommentModel"."id" ' ++ 'AND "deletedAt" IS NULL ' +'AND "accountId" NOT IN (SELECT "id" FROM "blocklist")' +')'),diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.tsindex 6aa9960380..e80d69cf3f 100644--- a/server/tests/api/videos/multiple-servers.ts+++ b/server/tests/api/videos/multiple-servers.ts@@ -934,7 +934,7 @@ describe('Test multiple servers', function () {expect(deletedComment.text).to.equal('')expect(deletedComment.inReplyToCommentId).to.be.nullexpect(deletedComment.account).to.be.null- expect(deletedComment.totalReplies).to.equal(3)+ expect(deletedComment.totalReplies).to.equal(2)expect(dateIsValid(deletedComment.createdAt as string)).to.be.trueexpect(dateIsValid(deletedComment.updatedAt as string)).to.be.trueexpect(dateIsValid(deletedComment.deletedAt as string)).to.be.true@@ -976,7 +976,7 @@ describe('Test multiple servers', function () {expect(comment.createdAt).to.not.be.nullexpect(comment.deletedAt).to.not.be.nullexpect(comment.account).to.be.null- expect(comment.totalReplies).to.equal(3)+ expect(comment.totalReplies).to.equal(2)}}})diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.tsindex a5ff3a39dd..b6b0023072 100644--- a/server/tests/api/videos/video-comments.ts+++ b/server/tests/api/videos/video-comments.ts@@ -231,7 +231,7 @@ describe('Test video comments', function () {expect(res.body.data[0].isDeleted).to.be.trueexpect(res.body.data[0].deletedAt).to.not.be.nullexpect(res.body.data[0].account).to.be.null- expect(res.body.data[0].totalReplies).to.equal(3)+ expect(res.body.data[0].totalReplies).to.equal(2)expect(res.body.data[1].text).to.equal('super thread 2')expect(res.body.data[1].totalReplies).to.equal(0)expect(res.body.data[2].text).to.equal('super thread 3')