From b3580b6971ed539c0d979e2b80631d0dc26e04c8 Mon Sep 17 00:00:00 2001 From: squidboi Date: Fri, 8 Jun 2018 18:29:41 -0700 Subject: [PATCH] add option to not deny follow if blocked (fixed) --- config/config.exs | 2 +- lib/pleroma/user.ex | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/config.exs b/config/config.exs index ea08a5f71..58b17e206 100644 --- a/config/config.exs +++ b/config/config.exs @@ -62,7 +62,7 @@ unfollow_blocked: true, outgoing_blocks: true -config :pleroma, :activitypub, +config :pleroma, :user, deny_follow_blocked: true config :pleroma, :mrf_simple, diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 828370cab..649fe8f6d 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -168,6 +168,9 @@ def register_changeset(struct, params \\ %{}) do end end + @user_config Application.get_env(:pleroma, :user) + @deny_follow_blocked Keyword.get(@ap_config, :deny_follow_blocked) + def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do user_info = user_info(followed) @@ -178,7 +181,7 @@ def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do false # if the users are blocking each other, we shouldn't even be here, but check for it anyway - User.blocks?(follower, followed) == true or User.blocks?(followed, follower) == true -> + deny_follow_blocked and (User.blocks?(follower, followed) or User.blocks?(followed, follower)) -> false # if OStatus, then there is no three-way handshake to follow @@ -197,6 +200,9 @@ def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do end end + @user_config Application.get_env(:pleroma, :user) + @deny_follow_blocked Keyword.get(@ap_config, :deny_follow_blocked) + def follow(%User{} = follower, %User{info: info} = followed) do ap_followers = followed.follower_address @@ -204,7 +210,7 @@ def follow(%User{} = follower, %User{info: info} = followed) do following?(follower, followed) or info["deactivated"] -> {:error, "Could not follow user: #{followed.nickname} is already on your list."} - blocks?(followed, follower) -> + deny_follow_blocked and blocks?(followed, follower) -> {:error, "Could not follow user: #{followed.nickname} blocked you."} true ->