- await forwardActivity(activity, t, exceptions)
- }
- })
-}
-
-async function processCreateView (byActor: ActorModel, activity: ActivityCreate) {
- const view = activity.object as ViewObject
-
- const video = await VideoModel.loadByUrlAndPopulateAccount(view.object)
-
- if (!video) throw new Error('Unknown video ' + view.object)
-
- 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)