]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/video-comment.ts
Apply the fix to both expanded and not expanded, using convention
[github/Chocobozzz/PeerTube.git] / server / lib / video-comment.ts
index bb811bd2c3d4b5749eb075b56cf3e428d15d80fe..fe83d23e7b1c766646a0dbc2a4909024f72b56e2 100644 (file)
@@ -7,9 +7,9 @@ import { sendCreateVideoComment } from './activitypub/send'
 import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight } from '../typings/models'
 
 async function createVideoComment (obj: {
-  text: string,
-  inReplyToComment: MComment | null,
-  video: MVideoFullLight,
+  text: string
+  inReplyToComment: MComment | null
+  video: MVideoFullLight
   account: MAccountDefault
 }, t: Sequelize.Transaction) {
   let originCommentId: number | null = null
@@ -73,9 +73,16 @@ function buildFormattedCommentTree (resultList: ResultList<VideoCommentModel>):
   return thread
 }
 
+function markCommentAsDeleted (comment: MCommentOwnerVideoReply): void {
+  comment.text = ''
+  comment.deletedAt = new Date()
+  comment.accountId = null
+}
+
 // ---------------------------------------------------------------------------
 
 export {
   createVideoComment,
-  buildFormattedCommentTree
+  buildFormattedCommentTree,
+  markCommentAsDeleted
 }