change the anti-link-spam MRF implementation to use old_user? instead of the previous name
This commit is contained in:
parent
630ac6a921
commit
127a5a7d65
1 changed files with 3 additions and 3 deletions
|
@ -8,7 +8,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy do
|
|||
require Logger
|
||||
|
||||
# has the user successfully posted before?
|
||||
defp user_has_posted_before?(%User{} = u) do
|
||||
defp old_user?(%User{} = u) do
|
||||
u.info.note_count > 0 || u.info.follower_count > 0
|
||||
end
|
||||
|
||||
|
@ -25,13 +25,13 @@ defp contains_links?(_), do: false
|
|||
def filter(%{"type" => "Create", "actor" => actor, "object" => object} = message) do
|
||||
with {:ok, %User{} = u} <- User.get_or_fetch_by_ap_id(actor),
|
||||
{:contains_links, true} <- {:contains_links, contains_links?(object)},
|
||||
{:posted_before, true} <- {:posted_before, user_has_posted_before?(u)} do
|
||||
{:old_user, true} <- {:old_user, old_user?(u)} do
|
||||
{:ok, message}
|
||||
else
|
||||
{:contains_links, false} ->
|
||||
{:ok, message}
|
||||
|
||||
{:posted_before, false} ->
|
||||
{:old_user, false} ->
|
||||
{:reject, nil}
|
||||
|
||||
{:error, _} ->
|
||||
|
|
Loading…
Reference in a new issue