X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fvideo-comments.ts;h=3f9d8f0fc4a4c85c46f3c84e8eb8f76180790aa3;hb=2ba92871319d7af63472c1380664a9f9eeb1c690;hp=e87301fe7d0b25250d67579de96ca5680828bd82;hpb=cef534ed53e4518fe0acf581bfe880788d42fc36;p=github%2FChocobozzz%2FPeerTube.git 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 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(entry, { returning: true }) comment.Account = actor.Account comment.Video = videoInstance