logger.debug('Reporting remote abuse for video %s.', getAPId(flag.object))
const account = byActor.Account
- if (!account) throw new Error('Cannot create dislike with the non account actor ' + byActor.url)
+ if (!account) throw new Error('Cannot create video abuse with the non account actor ' + byActor.url)
const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: flag.object })
- return sequelizeTypescript.transaction(async t => {
+ const videoAbuse = await sequelizeTypescript.transaction(async t => {
const videoAbuseData = {
reporterAccountId: account.id,
reason: flag.content,
const videoAbuseInstance = await VideoAbuseModel.create(videoAbuseData, { transaction: t })
videoAbuseInstance.Video = video
- Notifier.Instance.notifyOnNewVideoAbuse(videoAbuseInstance)
-
logger.info('Remote abuse for video uuid %s created', flag.object)
+
+ return videoAbuseInstance
})
+
+ Notifier.Instance.notifyOnNewVideoAbuse(videoAbuse)
}