aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/process/process-delete.ts7
-rw-r--r--server/lib/video-comment.ts9
2 files changed, 14 insertions, 2 deletions
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts
index 79d0e0d79..e76132f91 100644
--- a/server/lib/activitypub/process/process-delete.ts
+++ b/server/lib/activitypub/process/process-delete.ts
@@ -5,6 +5,7 @@ import { sequelizeTypescript } from '../../../initializers'
5import { ActorModel } from '../../../models/activitypub/actor' 5import { ActorModel } from '../../../models/activitypub/actor'
6import { VideoModel } from '../../../models/video/video' 6import { VideoModel } from '../../../models/video/video'
7import { VideoCommentModel } from '../../../models/video/video-comment' 7import { VideoCommentModel } from '../../../models/video/video-comment'
8import { markCommentAsDeleted } from '../../video-comment'
8import { forwardVideoRelatedActivity } from '../send/utils' 9import { forwardVideoRelatedActivity } from '../send/utils'
9import { VideoPlaylistModel } from '../../../models/video/video-playlist' 10import { VideoPlaylistModel } from '../../../models/video/video-playlist'
10import { APProcessorOptions } from '../../../typings/activitypub-processor.model' 11import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
@@ -128,7 +129,11 @@ function processDeleteVideoComment (byActor: MActorSignature, videoComment: Vide
128 throw new Error(`Account ${byActor.url} does not own video comment ${videoComment.url} or video ${videoComment.Video.url}`) 129 throw new Error(`Account ${byActor.url} does not own video comment ${videoComment.url} or video ${videoComment.Video.url}`)
129 } 130 }
130 131
131 await videoComment.destroy({ transaction: t }) 132 await sequelizeTypescript.transaction(async t => {
133 markCommentAsDeleted(videoComment)
134
135 await videoComment.save()
136 })
132 137
133 if (videoComment.Video.isOwned()) { 138 if (videoComment.Video.isOwned()) {
134 // Don't resend the activity to the sender 139 // Don't resend the activity to the sender
diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts
index bb811bd2c..b8074e6d2 100644
--- a/server/lib/video-comment.ts
+++ b/server/lib/video-comment.ts
@@ -73,9 +73,16 @@ function buildFormattedCommentTree (resultList: ResultList<VideoCommentModel>):
73 return thread 73 return thread
74} 74}
75 75
76function markCommentAsDeleted (comment: MCommentOwnerVideoReply): void {
77 comment.text = ''
78 comment.deletedAt = new Date()
79 comment.accountId = null
80}
81
76// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
77 83
78export { 84export {
79 createVideoComment, 85 createVideoComment,
80 buildFormattedCommentTree 86 buildFormattedCommentTree,
87 markCommentAsDeleted
81} 88}