make follows take precedence over domain blocks
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>
Thu, 28 Nov 2019 10:38:38 +0000 (10:38 +0000)
committerSadposter <hannah+pleroma@coffee-and-dreams.uk>
Thu, 28 Nov 2019 10:38:38 +0000 (10:38 +0000)
lib/pleroma/user.ex
test/user_test.exs

index b18a4c6a5099a4d381ec72e51d78033323eb474d..6a97e19282fac375a21bd8c7f3d82e208ab9f724 100644 (file)
@@ -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
index 82e338e7599f6ae956f733c31be4674c488adb25..6a38204558b3d8e58a2dcedce72c8b8fe0cbceb1 100644 (file)
@@ -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