1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicy do
7 alias Pleroma.Web.ActivityPub.MRF
13 defp lookup_subchain(actor) do
14 with matches <- Config.get([:mrf_subchain, :match_actor]),
15 {match, subchain} <- Enum.find(matches, fn {k, _v} -> String.match?(actor, k) end) do
16 {:ok, match, subchain}
18 _e -> {:error, :notfound}
23 def filter(%{"actor" => actor} = message) do
24 with {:ok, match, subchain} <- lookup_subchain(actor) do
26 "[SubchainPolicy] Matched #{actor} against #{inspect(match)} with subchain #{
32 |> MRF.filter(message)
39 def filter(message), do: {:ok, message}