activitypub: mrf: tag policy: add support for processing follow requests
This commit is contained in:
parent
084bb8ccd5
commit
9a69f08e86
1 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue