summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/activity_pub/mrf.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/activity_pub/mrf.ex')
-rw-r--r--lib/pleroma/web/activity_pub/mrf.ex11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex
index 89037ade7..a880b023f 100644
--- a/lib/pleroma/web/activity_pub/mrf.ex
+++ b/lib/pleroma/web/activity_pub/mrf.ex
@@ -4,6 +4,7 @@
defmodule Pleroma.Web.ActivityPub.MRF do
require Logger
+ import Pleroma.Web.Utils.Guards, only: [not_empty_string: 1]
@behaviour Pleroma.Web.ActivityPub.MRF.PipelineFiltering
@@ -110,6 +111,16 @@ defmodule Pleroma.Web.ActivityPub.MRF do
end)
end
+ @spec normalize_instance_list(list()) :: [{String.t(), String.t()}]
+ def normalize_instance_list(list) do
+ Enum.map(list, fn
+ {host, reason} when not_empty_string(host) and not_empty_string(reason) -> {host, reason}
+ {host, _reason} when not_empty_string(host) -> {host, ""}
+ host when not_empty_string(host) -> {host, ""}
+ value -> raise "Invalid MRF config: #{inspect(value)}"
+ end)
+ end
+
def describe(policies) do
{:ok, policy_configs} =
policies