diff options
author | lain <lain@soykaf.club> | 2020-07-31 09:57:30 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-31 09:57:30 +0200 |
commit | 1dd162a5f75e6c2ef1813cd477e6d938127220d9 (patch) | |
tree | cbbf1b5e1806c276aa557e97d94e293505d68071 /lib | |
parent | e2e66e50d3066d48d8ef9200e7d221f5aeec4c44 (diff) | |
download | pleroma-1dd162a5f75e6c2ef1813cd477e6d938127220d9.tar.gz pleroma-1dd162a5f75e6c2ef1813cd477e6d938127220d9.zip |
SimplePolicy: Fix problem with DM leaks.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index ffaac767e..bb193475a 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -109,6 +109,10 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do {:ok, object} end + defp intersection(list1, list2) do + list1 -- list1 -- list2 + end + defp check_followers_only(%{host: actor_host} = _actor_info, object) do followers_only = Config.get([:mrf_simple, :followers_only]) @@ -125,8 +129,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do cc = FollowingRelationship.followers_ap_ids(user, fixed_cc) object - |> Map.put("to", [user.follower_address] ++ to) - |> Map.put("cc", cc) + |> Map.put("to", intersection([user.follower_address | to], fixed_to)) + |> Map.put("cc", intersection([user.follower_address | cc], fixed_cc)) else _ -> object end |