change the anti-link-spam MRF implementation to use old_user? instead of the previous...
authorWilliam Pitcock <nenolod@dereferenced.org>
Fri, 21 Jun 2019 22:27:14 +0000 (22:27 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Fri, 21 Jun 2019 22:27:14 +0000 (22:27 +0000)
lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex

index 14e5955ee17b37d985437dc1a5cea4477eb2893e..2da3eac2f975a722f492e4b22094b4f8bbee92bc 100644 (file)
@@ -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 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy do
   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, _} ->