ActivityPub create: discard activities from deactivated users
This commit is contained in:
parent
89954a2ce7
commit
9390492138
@ -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} =
|
||||
|
Loading…
Reference in New Issue
Block a user