obligatory format commit
This commit is contained in:
parent
fa97eddf8a
commit
c7cc80a9ee
2 changed files with 8 additions and 7 deletions
|
@ -1020,7 +1020,8 @@ defmodule Pleroma.User do
|
||||||
do: Enum.member?(user.muted_notifications, ap_id)
|
do: Enum.member?(user.muted_notifications, ap_id)
|
||||||
|
|
||||||
def blocks?(%User{} = user, %User{} = target) do
|
def blocks?(%User{} = user, %User{} = target) do
|
||||||
blocks_ap_id?(user, target) || (!User.following?(user, target) && blocks_domain?(user, target))
|
blocks_ap_id?(user, target) ||
|
||||||
|
(!User.following?(user, target) && blocks_domain?(user, target))
|
||||||
end
|
end
|
||||||
|
|
||||||
def blocks?(nil, _), do: false
|
def blocks?(nil, _), do: false
|
||||||
|
|
|
@ -881,13 +881,13 @@ defmodule Pleroma.UserTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "follows take precedence over domain blocks" do
|
test "follows take precedence over domain blocks" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
good_eggo = insert(:user, %{ap_id: "https://meanies.social/user/cuteposter"})
|
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)
|
{:ok, user} = User.block_domain(user, "meanies.social")
|
||||||
|
{:ok, user} = User.follow(user, good_eggo)
|
||||||
|
|
||||||
|
refute User.blocks?(user, good_eggo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue