diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video-comment.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index bf8da924d..5386a10aa 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -307,15 +307,15 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
307 | const query = { | 307 | const query = { |
308 | order: [ [ 'createdAt', order ] ], | 308 | order: [ [ 'createdAt', order ] ], |
309 | where: { | 309 | where: { |
310 | [ Sequelize.Op.or ]: [ | ||
311 | { id: comment.getThreadId() }, | ||
312 | { originCommentId: comment.getThreadId() } | ||
313 | ], | ||
314 | id: { | 310 | id: { |
311 | [ Sequelize.Op.in ]: Sequelize.literal('(' + | ||
312 | 'WITH RECURSIVE children (id, "inReplyToCommentId") AS ( ' + | ||
313 | 'SELECT id, "inReplyToCommentId" FROM "videoComment" WHERE id = ' + comment.id + ' UNION ' + | ||
314 | 'SELECT p.id, p."inReplyToCommentId" from "videoComment" p ' + | ||
315 | 'INNER JOIN children c ON c."inReplyToCommentId" = p.id) ' + | ||
316 | 'SELECT id FROM children' + | ||
317 | ')'), | ||
315 | [ Sequelize.Op.ne ]: comment.id | 318 | [ Sequelize.Op.ne ]: comment.id |
316 | }, | ||
317 | createdAt: { | ||
318 | [ Sequelize.Op.lt ]: comment.createdAt | ||
319 | } | 319 | } |
320 | }, | 320 | }, |
321 | transaction: t | 321 | transaction: t |