diff options
author | Alex Gleason <alex@alexgleason.me> | 2022-01-22 14:32:55 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2022-01-22 14:32:55 -0600 |
commit | e72fd4ceb68294eb3cfb3b80bd78600143792b36 (patch) | |
tree | 26c061e7bbf066ffb3ee9140c79a14bbf3e9c118 | |
parent | 9983799ccb19585ad8ed0de2546d71090b094277 (diff) | |
download | pleroma-e72fd4ceb68294eb3cfb3b80bd78600143792b36.tar.gz |
SimplePolicy reasons: handle legacy config
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf.ex | 5 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf_test.exs | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index bd6f6777f..89037ade7 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -104,7 +104,10 @@ defmodule Pleroma.Web.ActivityPub.MRF do @spec instance_list_from_tuples([{String.t(), String.t()}]) :: [String.t()] def instance_list_from_tuples(list) do - Enum.map(list, fn {instance, _} -> instance end) + Enum.map(list, fn + {instance, _} -> instance + instance when is_binary(instance) -> instance + end) end def describe(policies) do diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index 6ab27bc86..fd88435ff 100644 --- a/test/pleroma/web/activity_pub/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -70,6 +70,13 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do assert MRF.instance_list_from_tuples(list) == expected end + + test "it handles legacy config" do + list = [{"some.tld", "a reason"}, "other.tld"] + expected = ["some.tld", "other.tld"] + + assert MRF.instance_list_from_tuples(list) == expected + end end describe "describe/0" do |