Commit 9a69f08e authored by William Pitcock's avatar William Pitcock

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

parent 084bb8cc
Pipeline #7021 passed with stages
in 5 minutes and 20 seconds
......@@ -88,7 +88,20 @@ defp process_tag(
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 @@ def filter(%{"actor" => actor} = message) do
error
end)
end
@impl true
def filter(message), do: {:ok, message}
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment