From 511765c9f86fb07d5d856decd9dbf0ec2092f4fe Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Aug 2019 15:35:29 +0200 Subject: Remove comment federation by video owner --- server/controllers/api/videos/comment.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/controllers/api') diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 39d521f5f..bc6d81a7c 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts @@ -27,6 +27,10 @@ import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../. import { AccountModel } from '../../../models/account/account' import { Notifier } from '../../../lib/notifier' import { Hooks } from '../../../lib/plugins/hooks' +import { ActorModel } from '../../../models/activitypub/actor' +import { VideoChannelModel } from '../../../models/video/video-channel' +import { VideoModel } from '../../../models/video/video' +import { sendDeleteVideoComment } from '../../../lib/activitypub/send' const auditLogger = auditLoggerFactory('comments') const videoCommentRouter = express.Router() @@ -179,6 +183,10 @@ async function removeVideoComment (req: express.Request, res: express.Response) await sequelizeTypescript.transaction(async t => { await videoCommentInstance.destroy({ transaction: t }) + + if (videoCommentInstance.isOwned() || videoCommentInstance.Video.isOwned()) { + await sendDeleteVideoComment(videoCommentInstance, t) + } }) auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) -- cgit v1.2.3