Fix mentions in comments

pull/370/head
Chocobozzz 2018-03-21 11:17:01 +01:00
parent 30f550251d
commit a3cffab42d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 7 deletions

View File

@ -307,15 +307,15 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
const query = { const query = {
order: [ [ 'createdAt', order ] ], order: [ [ 'createdAt', order ] ],
where: { where: {
[ Sequelize.Op.or ]: [
{ id: comment.getThreadId() },
{ originCommentId: comment.getThreadId() }
],
id: { id: {
[ Sequelize.Op.in ]: Sequelize.literal('(' +
'WITH RECURSIVE children (id, "inReplyToCommentId") AS ( ' +
'SELECT id, "inReplyToCommentId" FROM "videoComment" WHERE id = ' + comment.id + ' UNION ' +
'SELECT p.id, p."inReplyToCommentId" from "videoComment" p ' +
'INNER JOIN children c ON c."inReplyToCommentId" = p.id) ' +
'SELECT id FROM children' +
')'),
[ Sequelize.Op.ne ]: comment.id [ Sequelize.Op.ne ]: comment.id
},
createdAt: {
[ Sequelize.Op.lt ]: comment.createdAt
} }
}, },
transaction: t transaction: t