diff options
Diffstat (limited to 'server/lib/video-comment.ts')
-rw-r--r-- | server/lib/video-comment.ts | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts index 736ebb2f8..c76570a5d 100644 --- a/server/lib/video-comment.ts +++ b/server/lib/video-comment.ts | |||
@@ -3,7 +3,7 @@ import * as Sequelize from 'sequelize' | |||
3 | import { logger } from '@server/helpers/logger' | 3 | import { logger } from '@server/helpers/logger' |
4 | import { sequelizeTypescript } from '@server/initializers/database' | 4 | import { sequelizeTypescript } from '@server/initializers/database' |
5 | import { ResultList } from '../../shared/models' | 5 | import { ResultList } from '../../shared/models' |
6 | import { VideoCommentThreadTree } from '../../shared/models/videos/video-comment.model' | 6 | import { VideoCommentThreadTree } from '../../shared/models/videos/comment/video-comment.model' |
7 | import { VideoCommentModel } from '../models/video/video-comment' | 7 | import { VideoCommentModel } from '../models/video/video-comment' |
8 | import { MAccountDefault, MComment, MCommentOwnerVideo, MCommentOwnerVideoReply, MVideoFullLight } from '../types/models' | 8 | import { MAccountDefault, MComment, MCommentOwnerVideo, MCommentOwnerVideoReply, MVideoFullLight } from '../types/models' |
9 | import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send' | 9 | import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send' |
@@ -18,9 +18,9 @@ async function removeComment (videoCommentInstance: MCommentOwnerVideo) { | |||
18 | await sendDeleteVideoComment(videoCommentInstance, t) | 18 | await sendDeleteVideoComment(videoCommentInstance, t) |
19 | } | 19 | } |
20 | 20 | ||
21 | markCommentAsDeleted(videoCommentInstance) | 21 | videoCommentInstance.markAsDeleted() |
22 | 22 | ||
23 | await videoCommentInstance.save() | 23 | await videoCommentInstance.save({ transaction: t }) |
24 | }) | 24 | }) |
25 | 25 | ||
26 | logger.info('Video comment %d deleted.', videoCommentInstance.id) | 26 | logger.info('Video comment %d deleted.', videoCommentInstance.id) |
@@ -95,17 +95,10 @@ function buildFormattedCommentTree (resultList: ResultList<VideoCommentModel>): | |||
95 | return thread | 95 | return thread |
96 | } | 96 | } |
97 | 97 | ||
98 | function markCommentAsDeleted (comment: MComment): void { | ||
99 | comment.text = '' | ||
100 | comment.deletedAt = new Date() | ||
101 | comment.accountId = null | ||
102 | } | ||
103 | |||
104 | // --------------------------------------------------------------------------- | 98 | // --------------------------------------------------------------------------- |
105 | 99 | ||
106 | export { | 100 | export { |
107 | removeComment, | 101 | removeComment, |
108 | createVideoComment, | 102 | createVideoComment, |
109 | buildFormattedCommentTree, | 103 | buildFormattedCommentTree |
110 | markCommentAsDeleted | ||
111 | } | 104 | } |