mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
ActivityPub create: discard activities from deactivated users
This commit is contained in:
parent
89954a2ce7
commit
9390492138
1 changed files with 11 additions and 0 deletions
|
@ -16,9 +16,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
(data["to"] || []) ++ (data["cc"] || [])
|
(data["to"] || []) ++ (data["cc"] || [])
|
||||||
end
|
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
|
def insert(map, local \\ true) when is_map(map) do
|
||||||
with nil <- Activity.get_by_ap_id(map["id"]),
|
with nil <- Activity.get_by_ap_id(map["id"]),
|
||||||
map <- lazy_put_activity_defaults(map),
|
map <- lazy_put_activity_defaults(map),
|
||||||
|
:ok <- check_actor_is_active(map["actor"]),
|
||||||
{:ok, map} <- MRF.filter(map),
|
{:ok, map} <- MRF.filter(map),
|
||||||
:ok <- insert_full_object(map) do
|
:ok <- insert_full_object(map) do
|
||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
|
|
Loading…
Reference in a new issue