X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-comment.ts;h=b33c33d5efa002bc52f618584cefcfe508fa70a8;hb=3d527ba173a37bd61ec8ad742642bb320d12995c;hp=fb4d16b4d17b878f595f3e8c2c5482abf0b59138;hpb=562724a1ed13fe93aba08ca1a0f8e029819e9f32;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index fb4d16b4d..b33c33d5e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -257,10 +257,10 @@ export class VideoCommentModel extends Model { } static async listThreadsForApi (parameters: { - videoId: number, - start: number, - count: number, - sort: string, + videoId: number + start: number + count: number + sort: string user?: MUserAccountId }) { const { videoId, start, count, sort, user } = parameters @@ -300,8 +300,8 @@ export class VideoCommentModel extends Model { } static async listThreadCommentsForApi (parameters: { - videoId: number, - threadId: number, + videoId: number + threadId: number user?: MUserAccountId }) { const { videoId, threadId, user } = parameters @@ -314,7 +314,7 @@ export class VideoCommentModel extends Model { order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ] as Order, where: { videoId, - [ Op.or ]: [ + [Op.or]: [ { id: threadId }, { originCommentId: threadId } ], @@ -346,7 +346,7 @@ export class VideoCommentModel extends Model { order: [ [ 'createdAt', order ] ] as Order, where: { id: { - [ Op.in ]: Sequelize.literal('(' + + [Op.in]: Sequelize.literal('(' + 'WITH RECURSIVE children (id, "inReplyToCommentId") AS ( ' + `SELECT id, "inReplyToCommentId" FROM "videoComment" WHERE id = ${comment.id} ` + 'UNION ' + @@ -355,7 +355,7 @@ export class VideoCommentModel extends Model { ') ' + 'SELECT id FROM children' + ')'), - [ Op.ne ]: comment.id + [Op.ne]: comment.id } }, transaction: t @@ -461,7 +461,7 @@ export class VideoCommentModel extends Model { } isDeleted () { - return null !== this.deletedAt + return this.deletedAt !== null } extractMentions () {