diff options
author | Alex Gleason <alex@alexgleason.me> | 2022-01-22 15:53:08 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2022-01-22 15:53:08 -0600 |
commit | acfded5ae8b5f9180aeebe9c942fb4a620f13a13 (patch) | |
tree | 8bf9f30072813dce05940482dec0648b421ee521 /lib/pleroma/web/activity_pub/mrf.ex | |
parent | e72fd4ceb68294eb3cfb3b80bd78600143792b36 (diff) | |
download | pleroma-mrf-tuples-fix.tar.gz |
MRF reasons: normalize config for backwards compatibilitymrf-tuples-fix
Diffstat (limited to 'lib/pleroma/web/activity_pub/mrf.ex')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf.ex | 11 |
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 |