diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-08 13:15:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-08 13:15:01 +0100 |
commit | 378557ef2584e334392193b63bb2108fac6741fc (patch) | |
tree | 3d9792af5b11980bbf47fd964fef61e4237a8461 | |
parent | 9273b2d8ff479aef0e29c46deba2f05ab7075517 (diff) | |
download | PeerTube-378557ef2584e334392193b63bb2108fac6741fc.tar.gz PeerTube-378557ef2584e334392193b63bb2108fac6741fc.tar.zst PeerTube-378557ef2584e334392193b63bb2108fac6741fc.zip |
Fix comment creation
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 32be37e2d..e65b257c0 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -283,7 +283,7 @@ function createVideoComment (byActor: ActorModel, activity: ActivityCreate) { | |||
283 | const inReplyToComment = await VideoCommentModel.loadByUrl(comment.inReplyTo, t) | 283 | const inReplyToComment = await VideoCommentModel.loadByUrl(comment.inReplyTo, t) |
284 | if (!inReplyToComment) throw new Error('Unknown replied comment ' + comment.inReplyTo) | 284 | if (!inReplyToComment) throw new Error('Unknown replied comment ' + comment.inReplyTo) |
285 | 285 | ||
286 | video = await VideoModel.load(inReplyToComment.videoId) | 286 | video = await VideoModel.loadAndPopulateAccount(inReplyToComment.videoId) |
287 | 287 | ||
288 | const originCommentId = inReplyToComment.originCommentId || inReplyToComment.id | 288 | const originCommentId = inReplyToComment.originCommentId || inReplyToComment.id |
289 | objectToCreate = { | 289 | objectToCreate = { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 4d15c2a50..918892938 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -507,6 +507,10 @@ export class VideoModel extends Model<VideoModel> { | |||
507 | return VideoModel.findById(id) | 507 | return VideoModel.findById(id) |
508 | } | 508 | } |
509 | 509 | ||
510 | static loadAndPopulateAccount (id: number) { | ||
511 | return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS ]).findById(id) | ||
512 | } | ||
513 | |||
510 | static loadByUrl (url: string, t?: Sequelize.Transaction) { | 514 | static loadByUrl (url: string, t?: Sequelize.Transaction) { |
511 | const query: IFindOptions<VideoModel> = { | 515 | const query: IFindOptions<VideoModel> = { |
512 | where: { | 516 | where: { |