aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-26 16:26:27 +0100
committerChocobozzz <me@florianbigard.com>2021-03-03 10:08:08 +0100
commit74d249bc1346c7cfaac7ee49bebbebcf2a01f82a (patch)
treed47bd163ae57ed8f15b445296634cc04f4f67b6f /server/models/video/video-comment.ts
parent095e2258043fcff8a79ab082d11edfbd8f13a8e2 (diff)
downloadPeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.gz
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.tar.zst
PeerTube-74d249bc1346c7cfaac7ee49bebbebcf2a01f82a.zip
Add ability to cleanup remote AP interactions
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: {