add option to not deny follow if blocked (fixed)
authorsquidboi <squidboi@waifu.club>
Sat, 9 Jun 2018 01:29:41 +0000 (18:29 -0700)
committersquidboi <squidboi@waifu.club>
Sat, 9 Jun 2018 01:29:41 +0000 (18:29 -0700)
config/config.exs
lib/pleroma/user.ex

index ea08a5f7188f01e09cc8478b416edd53e086e3a2..58b17e2068558a8df911935aed794e36534afea1 100644 (file)
@@ -62,7 +62,7 @@ config :pleroma, :activitypub,
   unfollow_blocked: true,
   outgoing_blocks: true
 
-config :pleroma, :activitypub,
+config :pleroma, :user,
   deny_follow_blocked: true
 
 config :pleroma, :mrf_simple,
index 828370cabb43df0e61d206fddd87b292f9fdc8a2..649fe8f6d40d6c01909d047f3b49ba60e0e95b7e 100644 (file)
@@ -168,6 +168,9 @@ defmodule Pleroma.User 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 @@ defmodule Pleroma.User 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 @@ defmodule Pleroma.User 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 @@ defmodule Pleroma.User 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 ->