diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-21 11:17:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-21 11:17:01 +0100 |
commit | a3cffab42d78560a7db8ad1df14680be5b55277f (patch) | |
tree | 971a5e06e9f6f050e359e7996a4be3557167be42 /server/models/video | |
parent | 30f550251d2400af6bc9f469b0766453cdb7cdb6 (diff) | |
download | PeerTube-a3cffab42d78560a7db8ad1df14680be5b55277f.tar.gz PeerTube-a3cffab42d78560a7db8ad1df14680be5b55277f.tar.zst PeerTube-a3cffab42d78560a7db8ad1df14680be5b55277f.zip |
Fix mentions in comments
Diffstat (limited to 'server/models/video')
-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 |