aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r--server/models/video/video-comment.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index dc7556d44..151c2bc81 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -1,5 +1,5 @@
1import { uniq } from 'lodash' 1import { uniq } from 'lodash'
2import { FindAndCountOptions, FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize' 2import { FindAndCountOptions, FindOptions, Op, Order, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'
3import { 3import {
4 AllowNull, 4 AllowNull,
5 BelongsTo, 5 BelongsTo,
@@ -696,6 +696,18 @@ export class VideoCommentModel extends Model {
696 } 696 }
697 } 697 }
698 698
699 static listRemoteCommentUrlsOfLocalVideos () {
700 const query = `SELECT "videoComment".url FROM "videoComment" ` +
701 `INNER JOIN account ON account.id = "videoComment"."accountId" ` +
702 `INNER JOIN actor ON actor.id = "account"."actorId" AND actor."serverId" IS NOT NULL ` +
703 `INNER JOIN video ON video.id = "videoComment"."videoId" AND video.remote IS FALSE`
704
705 return VideoCommentModel.sequelize.query<{ url: string }>(query, {
706 type: QueryTypes.SELECT,
707 raw: true
708 }).then(rows => rows.map(r => r.url))
709 }
710
699 static cleanOldCommentsOf (videoId: number, beforeUpdatedAt: Date) { 711 static cleanOldCommentsOf (videoId: number, beforeUpdatedAt: Date) {
700 const query = { 712 const query = {
701 where: { 713 where: {