X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fvideo-comment.ts;h=516c912a90a30f0f3e679e65e37384ee6a3c3542;hb=fa11e79d4ad9211848938af490493078437bf500;hp=bb811bd2c3d4b5749eb075b56cf3e428d15d80fe;hpb=00aab0666c6f772548c160fdfa871a8843b88f37;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts index bb811bd2c..516c912a9 100644 --- a/server/lib/video-comment.ts +++ b/server/lib/video-comment.ts @@ -2,14 +2,14 @@ import * as Sequelize from 'sequelize' import { ResultList } from '../../shared/models' import { VideoCommentThreadTree } from '../../shared/models/videos/video-comment.model' import { VideoCommentModel } from '../models/video/video-comment' -import { getVideoCommentActivityPubUrl } from './activitypub' +import { getVideoCommentActivityPubUrl } from './activitypub/url' 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): return thread } +function markCommentAsDeleted (comment: MCommentOwnerVideoReply): void { + comment.text = '' + comment.deletedAt = new Date() + comment.accountId = null +} + // --------------------------------------------------------------------------- export { createVideoComment, - buildFormattedCommentTree + buildFormattedCommentTree, + markCommentAsDeleted }