From: William Pitcock <nenolod@dereferenced.org>
Date: Sat, 19 May 2018 03:17:56 +0000 (-0500)
Subject: remote user deactivation: fix test failures
X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=13d4b6d2b5d17c10fb5a95e02ff668de8eeb15ea;p=akkoma

remote user deactivation: fix test failures
---

diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 76cda0b4c..c026f2427 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -17,10 +17,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   end
 
   defp check_actor_is_active(actor) do
-    user = User.get_cached_by_ap_id(actor)
-
-    if user.info["deactivated"] == true do
-      :reject
+    if not is_nil(actor) do
+      with user <- User.get_cached_by_ap_id(actor),
+           nil <- user.info["deactivated"] do
+        :ok
+      else
+        _e -> :reject
+      end
     else
       :ok
     end