defp process_tag(_, message), do: {:ok, message}
- @impl true
- def filter(%{"object" => target_actor, "type" => "Follow"} = message) do
- User.get_cached_by_ap_id(target_actor)
+ def filter_message(actor, message) do
+ User.get_cached_by_ap_id(actor)
|> get_tags()
|> Enum.reduce({:ok, message}, fn
tag, {:ok, message} ->
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
- tag, {:ok, message} ->
- process_tag(tag, message)
+ def filter(%{"object" => target_actor, "type" => "Follow"} = message),
+ do: filter_message(target_actor, message)
- _, error ->
- error
- end)
- end
+ @impl true
+ def filter(%{"actor" => actor, "type" => "Create"} = message),
+ do: filter_message(actor, message)
@impl true
def filter(message), do: {:ok, message}