1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Cleanup invalid rates/comments/shares

This commit is contained in:
Chocobozzz 2019-03-19 16:23:02 +01:00
parent d74d29ad9e
commit 2ba9287131
No known key found for this signature in database
GPG key ID: 583A612D890159BE
16 changed files with 117 additions and 49 deletions

View file

@ -34,8 +34,7 @@ async function videoCommentActivityObjectToDBAttributes (video: VideoModel, acto
accountId: actor.Account.id,
inReplyToCommentId,
originCommentId,
createdAt: new Date(comment.published),
updatedAt: new Date(comment.updated)
createdAt: new Date(comment.published)
}
}
@ -74,12 +73,7 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) {
const entry = await videoCommentActivityObjectToDBAttributes(videoInstance, actor, body)
if (!entry) return { created: false }
const [ comment, created ] = await VideoCommentModel.findOrCreate({
where: {
url: body.id
},
defaults: entry
})
const [ comment, created ] = await VideoCommentModel.upsert<VideoCommentModel>(entry, { returning: true })
comment.Account = actor.Account
comment.Video = videoInstance