From fa97eddf8a7e5c3a0ed51eff562d6592bd478b95 Mon Sep 17 00:00:00 2001 From: Sadposter Date: Thu, 28 Nov 2019 10:38:38 +0000 Subject: [PATCH] make follows take precedence over domain blocks --- lib/pleroma/user.ex | 2 +- test/user_test.exs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index b18a4c6a5..6a97e1928 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -1020,7 +1020,7 @@ def muted_notifications?(user, %{ap_id: ap_id}), do: Enum.member?(user.muted_notifications, ap_id) def blocks?(%User{} = user, %User{} = target) do - blocks_ap_id?(user, target) || blocks_domain?(user, target) + blocks_ap_id?(user, target) || (!User.following?(user, target) && blocks_domain?(user, target)) end def blocks?(nil, _), do: false diff --git a/test/user_test.exs b/test/user_test.exs index 82e338e75..6a3820455 100644 --- a/test/user_test.exs +++ b/test/user_test.exs @@ -879,6 +879,16 @@ test "unblocks domains" do refute User.blocks?(user, collateral_user) end + + test "follows take precedence over domain blocks" do + user = insert(:user) + good_eggo = insert(:user, %{ap_id: "https://meanies.social/user/cuteposter"}) + + {:ok, user} = User.block_domain(user, "meanies.social") + {:ok, user} = User.follow(user, good_eggo) + + refute User.blocks?(user, good_eggo) + end end describe "blocks_import" do