From: William Pitcock Date: Sun, 13 May 2018 23:28:56 +0000 (+0000) Subject: ActivityPub create: discard activities from deactivated users X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=93904921381300ddeefab99350cba5f551e0e2b0;p=akkoma ActivityPub create: discard activities from deactivated users --- 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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} =