]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/process/process-delete.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / process / process-delete.ts
index 604570e74808e56dc8948377a3cd13e94273028d..07e6a0075d40423545b9fbeaf03cc2b826f3d500 100644 (file)
@@ -11,8 +11,9 @@ import { getOrCreateActorAndServerAndModel } from '../actor'
 
 async function processDeleteActivity (activity: ActivityDelete) {
   const actor = await getOrCreateActorAndServerAndModel(activity.actor)
+  const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
 
-  if (actor.url === activity.id) {
+  if (actor.url === objectUrl) {
     if (actor.type === 'Person') {
       if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.')
 
@@ -25,14 +26,14 @@ async function processDeleteActivity (activity: ActivityDelete) {
   }
 
   {
-    const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(activity.id)
+    const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(objectUrl)
     if (videoCommentInstance) {
       return processDeleteVideoComment(actor, videoCommentInstance)
     }
   }
 
   {
-    const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(activity.id)
+    const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(objectUrl)
     if (videoInstance) {
       return processDeleteVideo(actor, videoInstance)
     }