- const account = await ActorModel.loadByUrl(view.actor)
- if (!account) throw new Error('Unknown account ' + view.actor)
-
- await video.increment('views')
-
- if (video.isOwned()) {
- // Don't resend the activity to the sender
- const exceptions = [ byActor ]
- await forwardActivity(activity, undefined, exceptions)
- }
-}
-
-function processCreateVideoAbuse (actor: ActorModel, videoAbuseToCreateData: VideoAbuseObject) {
- const options = {
- arguments: [ actor, videoAbuseToCreateData ],
- errorMessage: 'Cannot insert the remote video abuse with many retries.'
- }
-
- return retryTransactionWrapper(addRemoteVideoAbuse, options)
-}
-
-function addRemoteVideoAbuse (actor: ActorModel, videoAbuseToCreateData: VideoAbuseObject) {
- logger.debug('Reporting remote abuse for video %s.', videoAbuseToCreateData.object)
-
- const account = actor.Account
- if (!account) throw new Error('Cannot create dislike with the non account actor ' + actor.url)
-
- return sequelizeTypescript.transaction(async t => {
- const video = await VideoModel.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t)
- if (!video) {
- logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object)
- return undefined