diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 16:23:02 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 16:23:02 +0100 |
commit | 2ba92871319d7af63472c1380664a9f9eeb1c690 (patch) | |
tree | d593b2dfea29a8171b9f6afaaef076321f5edf71 /server/lib/activitypub/video-comments.ts | |
parent | d74d29ad9e35929491cf37223398d2535ab23de0 (diff) | |
download | PeerTube-2ba92871319d7af63472c1380664a9f9eeb1c690.tar.gz PeerTube-2ba92871319d7af63472c1380664a9f9eeb1c690.tar.zst PeerTube-2ba92871319d7af63472c1380664a9f9eeb1c690.zip |
Cleanup invalid rates/comments/shares
Diffstat (limited to 'server/lib/activitypub/video-comments.ts')
-rw-r--r-- | server/lib/activitypub/video-comments.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index e87301fe7..3f9d8f0fc 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts | |||
@@ -34,8 +34,7 @@ async function videoCommentActivityObjectToDBAttributes (video: VideoModel, acto | |||
34 | accountId: actor.Account.id, | 34 | accountId: actor.Account.id, |
35 | inReplyToCommentId, | 35 | inReplyToCommentId, |
36 | originCommentId, | 36 | originCommentId, |
37 | createdAt: new Date(comment.published), | 37 | createdAt: new Date(comment.published) |
38 | updatedAt: new Date(comment.updated) | ||
39 | } | 38 | } |
40 | } | 39 | } |
41 | 40 | ||
@@ -74,12 +73,7 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) { | |||
74 | const entry = await videoCommentActivityObjectToDBAttributes(videoInstance, actor, body) | 73 | const entry = await videoCommentActivityObjectToDBAttributes(videoInstance, actor, body) |
75 | if (!entry) return { created: false } | 74 | if (!entry) return { created: false } |
76 | 75 | ||
77 | const [ comment, created ] = await VideoCommentModel.findOrCreate({ | 76 | const [ comment, created ] = await VideoCommentModel.upsert<VideoCommentModel>(entry, { returning: true }) |
78 | where: { | ||
79 | url: body.id | ||
80 | }, | ||
81 | defaults: entry | ||
82 | }) | ||
83 | comment.Account = actor.Account | 77 | comment.Account = actor.Account |
84 | comment.Video = videoInstance | 78 | comment.Video = videoInstance |
85 | 79 | ||