Enforce that the followbot must be marked as a bot.

This commit is contained in:
Mark Felder 2020-10-08 12:41:01 -05:00 committed by Mark Felder
parent 840dc4b44b
commit e78738173a

View File

@ -8,14 +8,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do
@impl true @impl true
def filter(message) do def filter(message) do
with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]),
%User{} = follower <- User.get_cached_by_nickname(follower_nickname), %User{actor_type: "Service"} = follower <-
User.get_cached_by_nickname(follower_nickname),
%{"type" => "Create", "object" => %{"type" => "Note"}} <- message do %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do
try_follow(follower, message) try_follow(follower, message)
else else
nil -> nil ->
Logger.warn( Logger.warn(
"#{__MODULE__} skipped because of missing :mrf_follow_bot, :follower_nickname configuration or the account "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname
does not exist." account does not exist, or the account is not correctly configured as a bot."
) )
{:ok, message} {:ok, message}