From 93904921381300ddeefab99350cba5f551e0e2b0 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 13 May 2018 23:28:56 +0000 Subject: [PATCH] ActivityPub create: discard activities from deactivated users --- lib/pleroma/web/activity_pub/activity_pub.ex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 491ad3705..76cda0b4c 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -16,9 +16,20 @@ def get_recipients(data) do (data["to"] || []) ++ (data["cc"] || []) end + defp check_actor_is_active(actor) do + user = User.get_cached_by_ap_id(actor) + + if user.info["deactivated"] == true do + :reject + else + :ok + end + end + def insert(map, local \\ true) when is_map(map) do with nil <- Activity.get_by_ap_id(map["id"]), map <- lazy_put_activity_defaults(map), + :ok <- check_actor_is_active(map["actor"]), {:ok, map} <- MRF.filter(map), :ok <- insert_full_object(map) do {:ok, activity} =