+ if (byActorFull.type === 'Person') {
+ if (!byActorFull.Account) throw new Error('Actor ' + byActorFull.url + ' is a person but we cannot find it in database.')
+
+ const accountToDelete = byActorFull.Account as MAccountActor
+ accountToDelete.Actor = byActorFull
+
+ return retryTransactionWrapper(processDeleteAccount, accountToDelete)
+ } else if (byActorFull.type === 'Group') {
+ if (!byActorFull.VideoChannel) throw new Error('Actor ' + byActorFull.url + ' is a group but we cannot find it in database.')
+
+ const channelToDelete = byActorFull.VideoChannel as MChannelActorAccountActor
+ channelToDelete.Actor = byActorFull
+
+ return retryTransactionWrapper(processDeleteVideoChannel, channelToDelete)
+ }
+ }
+
+ {
+ const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(objectUrl)
+ if (videoCommentInstance) {
+ return retryTransactionWrapper(processDeleteVideoComment, byActor, videoCommentInstance, activity)
+ }
+ }
+
+ {
+ const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(objectUrl)
+ if (videoInstance) {
+ if (videoInstance.isOwned()) throw new Error(`Remote instance cannot delete owned video ${videoInstance.url}.`)
+
+ return retryTransactionWrapper(processDeleteVideo, byActor, videoInstance)