From: Sadposter Date: Thu, 28 Nov 2019 10:38:38 +0000 (+0000) Subject: make follows take precedence over domain blocks X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=fa97eddf8a7e5c3a0ed51eff562d6592bd478b95;p=akkoma make follows take precedence over domain blocks --- 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 @@ defmodule Pleroma.User do 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 @@ defmodule Pleroma.UserTest 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