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