ActivityPub create: discard activities from deactivated users

This commit is contained in:
William Pitcock 2018-05-13 23:28:56 +00:00
parent 89954a2ce7
commit 9390492138

View file

@ -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} =