1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-11-15 23:26:17 +01:00

activitypub: mrf: tag policy: add support for processing follow requests

This commit is contained in:
William Pitcock 2019-02-04 17:03:34 +00:00
parent 084bb8ccd5
commit 9a69f08e86

View File

@ -88,7 +88,20 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
defp process_tag(_, message), do: {:ok, message}
@impl true
def filter(%{"actor" => actor} = message) do
def filter(%{"object" => target_actor, "type" => "Follow"} = message) do
User.get_cached_by_ap_id(target_actor)
|> get_tags()
|> Enum.reduce({:ok, message}, fn
tag, {:ok, message} ->
process_tag(tag, message)
_, error ->
error
end)
end
@impl true
def filter(%{"actor" => actor, "type" => "Create"} = message) do
User.get_cached_by_ap_id(actor)
|> get_tags()
|> Enum.reduce({:ok, message}, fn
@ -99,4 +112,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
error
end)
end
@impl true
def filter(message), do: {:ok, message}
end