forked from AkkomaGang/akkoma
Refactor check_actor_is_active
This commit is contained in:
parent
ec969eec51
commit
5171aa5b4d
1 changed files with 5 additions and 7 deletions
|
@ -61,18 +61,16 @@ defp get_recipients(data) do
|
||||||
{recipients, to, cc}
|
{recipients, to, cc}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp check_actor_is_active(true, _), do: :ok
|
defp check_actor_is_active(actor) do
|
||||||
|
|
||||||
defp check_actor_is_active(false, actor) do
|
|
||||||
if not is_nil(actor) do
|
if not is_nil(actor) do
|
||||||
with user <- User.get_cached_by_ap_id(actor),
|
with user <- User.get_cached_by_ap_id(actor),
|
||||||
false <- user.info.deactivated do
|
false <- user.info.deactivated do
|
||||||
:ok
|
true
|
||||||
else
|
else
|
||||||
_e -> :reject
|
_e -> false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
:ok
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -124,7 +122,7 @@ def increase_poll_votes_if_vote(_create_data), do: :noop
|
||||||
def insert(map, local \\ true, fake \\ false, bypass_actor_check \\ false) when is_map(map) do
|
def insert(map, local \\ true, fake \\ false, bypass_actor_check \\ false) when is_map(map) do
|
||||||
with nil <- Activity.normalize(map),
|
with nil <- Activity.normalize(map),
|
||||||
map <- lazy_put_activity_defaults(map, fake),
|
map <- lazy_put_activity_defaults(map, fake),
|
||||||
:ok <- check_actor_is_active(bypass_actor_check, map["actor"]),
|
true <- bypass_actor_check || check_actor_is_active(map["actor"]),
|
||||||
{_, true} <- {:remote_limit_error, check_remote_limit(map)},
|
{_, true} <- {:remote_limit_error, check_remote_limit(map)},
|
||||||
{:ok, map} <- MRF.filter(map),
|
{:ok, map} <- MRF.filter(map),
|
||||||
{recipients, _, _} = get_recipients(map),
|
{recipients, _, _} = get_recipients(map),
|
||||||
|
|
Loading…
Reference in a new issue