aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-07 15:35:29 +0200
committerChocobozzz <me@florianbigard.com>2019-08-07 15:35:29 +0200
commit511765c9f86fb07d5d856decd9dbf0ec2092f4fe (patch)
tree07848a09e60e78b39aa3d22f7ba1e4915b23b02a /server/controllers
parentfd2ddcae8ff4eb10bf7168ac3c8801f06b37627f (diff)
downloadPeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.tar.gz
PeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.tar.zst
PeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.zip
Remove comment federation by video owner
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/comment.ts8
1 files changed, 8 insertions, 0 deletions
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 '../../.
27import { AccountModel } from '../../../models/account/account' 27import { AccountModel } from '../../../models/account/account'
28import { Notifier } from '../../../lib/notifier' 28import { Notifier } from '../../../lib/notifier'
29import { Hooks } from '../../../lib/plugins/hooks' 29import { Hooks } from '../../../lib/plugins/hooks'
30import { ActorModel } from '../../../models/activitypub/actor'
31import { VideoChannelModel } from '../../../models/video/video-channel'
32import { VideoModel } from '../../../models/video/video'
33import { sendDeleteVideoComment } from '../../../lib/activitypub/send'
30 34
31const auditLogger = auditLoggerFactory('comments') 35const auditLogger = auditLoggerFactory('comments')
32const videoCommentRouter = express.Router() 36const videoCommentRouter = express.Router()
@@ -179,6 +183,10 @@ async function removeVideoComment (req: express.Request, res: express.Response)
179 183
180 await sequelizeTypescript.transaction(async t => { 184 await sequelizeTypescript.transaction(async t => {
181 await videoCommentInstance.destroy({ transaction: t }) 185 await videoCommentInstance.destroy({ transaction: t })
186
187 if (videoCommentInstance.isOwned() || videoCommentInstance.Video.isOwned()) {
188 await sendDeleteVideoComment(videoCommentInstance, t)
189 }
182 }) 190 })
183 191
184 auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) 192 auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON()))