diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-07 15:35:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-07 15:35:29 +0200 |
commit | 511765c9f86fb07d5d856decd9dbf0ec2092f4fe (patch) | |
tree | 07848a09e60e78b39aa3d22f7ba1e4915b23b02a /server/controllers/api/videos/comment.ts | |
parent | fd2ddcae8ff4eb10bf7168ac3c8801f06b37627f (diff) | |
download | PeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.tar.gz PeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.tar.zst PeerTube-511765c9f86fb07d5d856decd9dbf0ec2092f4fe.zip |
Remove comment federation by video owner
Diffstat (limited to 'server/controllers/api/videos/comment.ts')
-rw-r--r-- | server/controllers/api/videos/comment.ts | 8 |
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 '../../. | |||
27 | import { AccountModel } from '../../../models/account/account' | 27 | import { AccountModel } from '../../../models/account/account' |
28 | import { Notifier } from '../../../lib/notifier' | 28 | import { Notifier } from '../../../lib/notifier' |
29 | import { Hooks } from '../../../lib/plugins/hooks' | 29 | import { Hooks } from '../../../lib/plugins/hooks' |
30 | import { ActorModel } from '../../../models/activitypub/actor' | ||
31 | import { VideoChannelModel } from '../../../models/video/video-channel' | ||
32 | import { VideoModel } from '../../../models/video/video' | ||
33 | import { sendDeleteVideoComment } from '../../../lib/activitypub/send' | ||
30 | 34 | ||
31 | const auditLogger = auditLoggerFactory('comments') | 35 | const auditLogger = auditLoggerFactory('comments') |
32 | const videoCommentRouter = express.Router() | 36 | const 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())) |