]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/video-comments.ts
Merge branch 'release/v1.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / video-comments.ts
index cb67bf9a49320c451e40aff7c16df0663b492eb2..c3fc6b4621926179d24621a38e8138ab1811051b 100644 (file)
@@ -73,15 +73,15 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) {
   const entry = await videoCommentActivityObjectToDBAttributes(videoInstance, actor, body)
   if (!entry) return { created: false }
 
-  // FIXME: sequelize typings
-  const [ comment, created ] = (await VideoCommentModel.upsert<VideoCommentModel>(entry, { returning: true }) as any)
+  const [ comment, created ] = await VideoCommentModel.upsert<VideoCommentModel>(entry, { returning: true })
   comment.Account = actor.Account
   comment.Video = videoInstance
 
   return { comment, created }
 }
 
-async function resolveThread (url: string, comments: VideoCommentModel[] = []) {
+type ResolveThreadResult = Promise<{ video: VideoModel, parents: VideoCommentModel[] }>
+async function resolveThread (url: string, comments: VideoCommentModel[] = []): ResolveThreadResult {
    // Already have this comment?
   const commentFromDatabase = await VideoCommentModel.loadByUrlAndPopulateReplyAndVideo(url)
   if (commentFromDatabase) {
@@ -162,7 +162,6 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) {
 
     return resolveThread(body.inReplyTo, comments.concat([ comment ]))
   }
-
 }
 
 export {