1
0
Fork 0

Fix comment creation

This commit is contained in:
Chocobozzz 2018-01-08 13:15:01 +01:00
parent 9273b2d8ff
commit 378557ef25
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 5 additions and 1 deletions

View 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 = {

View 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: {