Fix comment creation
authorChocobozzz <me@florianbigard.com>
Mon, 8 Jan 2018 12:15:01 +0000 (13:15 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 8 Jan 2018 12:15:01 +0000 (13:15 +0100)
server/lib/activitypub/process/process-create.ts
server/models/video/video.ts

index 32be37e2de534e617c889418cb9d48c8dcd9f71d..e65b257c0cb13bd3dd575ef0caa4c2e0bb13dfcb 100644 (file)
@@ -283,7 +283,7 @@ function createVideoComment (byActor: ActorModel, activity: ActivityCreate) {
       const inReplyToComment = await VideoCommentModel.loadByUrl(comment.inReplyTo, t)
       if (!inReplyToComment) throw new Error('Unknown replied comment ' + comment.inReplyTo)
 
-      video = await VideoModel.load(inReplyToComment.videoId)
+      video = await VideoModel.loadAndPopulateAccount(inReplyToComment.videoId)
 
       const originCommentId = inReplyToComment.originCommentId || inReplyToComment.id
       objectToCreate = {
index 4d15c2a5038c5ebf81a7d6c5f706434f7388e266..9188929384f96a21308d0bff09f71acb3d7057d8 100644 (file)
@@ -507,6 +507,10 @@ export class VideoModel extends Model<VideoModel> {
     return VideoModel.findById(id)
   }
 
+  static loadAndPopulateAccount (id: number) {
+    return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS ]).findById(id)
+  }
+
   static loadByUrl (url: string, t?: Sequelize.Transaction) {
     const query: IFindOptions<VideoModel> = {
       where: {