From 4e099fcfa9eb03cc281453611fa9224c9c040b26 Mon Sep 17 00:00:00 2001 From: squidboi Date: Sat, 23 Jun 2018 14:16:08 -0700 Subject: [PATCH] move configurable module attributes into relevant functions --- lib/pleroma/user.ex | 12 ++++++------ lib/pleroma/web/activity_pub/activity_pub.ex | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 1fcec479f..6000e74fc 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -168,10 +168,10 @@ def register_changeset(struct, params \\ %{}) do end end - @user_config Application.get_env(:pleroma, :user) - @deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) - def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do + @user_config Application.get_env(:pleroma, :user) + @deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) + user_info = user_info(followed) should_direct_follow = @@ -209,10 +209,10 @@ def maybe_follow(%User{} = follower, %User{info: info} = followed) do end end - @user_config Application.get_env(:pleroma, :user) - @deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) - def follow(%User{} = follower, %User{info: info} = followed) do + @user_config Application.get_env(:pleroma, :user) + @deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) + ap_followers = followed.follower_address cond do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index b174af7ce..b76edbd8b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -242,11 +242,11 @@ def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ tru end end - @ap_config Application.get_env(:pleroma, :activitypub) - @unfollow_blocked Keyword.get(@ap_config, :unfollow_blocked) - @outgoing_blocks Keyword.get(@ap_config, :outgoing_blocks) - def block(blocker, blocked, activity_id \\ nil, local \\ true) do + @ap_config Application.get_env(:pleroma, :activitypub) + @unfollow_blocked Keyword.get(@ap_config, :unfollow_blocked) + @outgoing_blocks Keyword.get(@ap_config, :outgoing_blocks) + with true <- @unfollow_blocked do follow_activity = fetch_latest_follow(blocker, blocked)