make follows take precedence over domain blocks

This commit is contained in:
Sadposter 2019-11-28 10:38:38 +00:00
parent cb656938ca
commit fa97eddf8a
2 changed files with 11 additions and 1 deletions

View 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

View 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