]> 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 3f9d8f0fc4a4c85c46f3c84e8eb8f76180790aa3..c3fc6b4621926179d24621a38e8138ab1811051b 100644 (file)
@@ -2,7 +2,7 @@ import { VideoCommentObject } from '../../../shared/models/activitypub/objects/v
 import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
 import { logger } from '../../helpers/logger'
 import { doRequest } from '../../helpers/requests'
-import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers'
+import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
 import { ActorModel } from '../../models/activitypub/actor'
 import { VideoModel } from '../../models/video/video'
 import { VideoCommentModel } from '../../models/video/video-comment'
@@ -80,7 +80,8 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) {
   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) {
@@ -161,7 +162,6 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) {
 
     return resolveThread(body.inReplyTo, comments.concat([ comment ]))
   }
-
 }
 
 export {