Fix lint
authorChocobozzz <me@florianbigard.com>
Wed, 13 Jun 2018 12:55:18 +0000 (14:55 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 13 Jun 2018 12:55:18 +0000 (14:55 +0200)
server/helpers/custom-validators/activitypub/activity.ts
server/lib/activitypub/process/process-delete.ts

index 1d2ef2ac6cfe56013aacf83a7fa55a735a7d175f..381a29e66b236e9407dfc6abd6daf2e827a18bc2 100644 (file)
@@ -16,6 +16,7 @@ import {
   sanitizeAndCheckVideoTorrentUpdateActivity
 } from './videos'
 import { isViewActivityValid } from './view'
+import { exists } from '../misc'
 
 function isRootActivityValid (activity: any) {
   return Array.isArray(activity['@context']) && (
@@ -26,6 +27,7 @@ function isRootActivityValid (activity: any) {
     ) ||
     (
       isActivityPubUrlValid(activity.id) &&
+      exists(activity.actor) &&
       (isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
     )
   )
index ff0caa343062f04262003fb9a70e7dbd1b92117d..3c830abea7a529b11a06bc000e437750a254709d 100644 (file)
@@ -15,7 +15,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
 
   if (activity.actor === objectUrl) {
     let actor = await ActorModel.loadByUrl(activity.actor)
-    if (!actor) return
+    if (!actor) return undefined
 
     if (actor.type === 'Person') {
       if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.')
@@ -45,7 +45,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
     }
   }
 
-  return
+  return undefined
 }
 
 // ---------------------------------------------------------------------------