- return db.sequelize.transaction(t => {
- return db.VideoAbuse.create(abuse, { transaction: t })
- .then(abuse => {
- // We send the information to the destination pod
- if (videoInstance.isOwned() === false) {
- const reportData = {
- reporterUsername,
- reportReason: abuse.reason,
- videoUUID: videoInstance.uuid
- }
-
- return friends.reportAbuseVideoToFriend(reportData, videoInstance, t).then(() => videoInstance)
- }
-
- return videoInstance
- })
- })
- .then((videoInstance: VideoInstance) => logger.info('Abuse report for video %s created.', videoInstance.name))
- .catch(err => {
- logger.debug('Cannot update the video.', err)
- throw err
+ await db.sequelize.transaction(async t => {
+ const abuse = await db.VideoAbuse.create(abuseToCreate, { transaction: t })
+ // We send the information to the destination server
+ if (videoInstance.isOwned() === false) {
+ const reportData = {
+ reporterUsername,
+ reportReason: abuse.reason,
+ videoUUID: videoInstance.uuid
+ }
+
+ // await friends.reportAbuseVideoToFriend(reportData, videoInstance, t)
+ // TODO: send abuse to origin server
+ }