change moved attributes into normal variables

This commit is contained in:
squidboi 2018-06-23 14:27:07 -07:00
parent 4e099fcfa9
commit f4990283de
No known key found for this signature in database
GPG Key ID: 018925A9B65D2457
2 changed files with 11 additions and 11 deletions

View File

@ -169,8 +169,8 @@ def register_changeset(struct, params \\ %{}) do
end end
def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do
@user_config Application.get_env(:pleroma, :user) user_config Application.get_env(:pleroma, :user)
@deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) deny_follow_blocked Keyword.get(user_config, :deny_follow_blocked)
user_info = user_info(followed) user_info = user_info(followed)
@ -181,7 +181,7 @@ def maybe_direct_follow(%User{} = follower, %User{info: info} = followed) do
false false
# if the users are blocking each other, we shouldn't even be here, but check for it anyway # if the users are blocking each other, we shouldn't even be here, but check for it anyway
@deny_follow_blocked and deny_follow_blocked and
(User.blocks?(follower, followed) or User.blocks?(followed, follower)) -> (User.blocks?(follower, followed) or User.blocks?(followed, follower)) ->
false false
@ -210,8 +210,8 @@ def maybe_follow(%User{} = follower, %User{info: info} = followed) do
end end
def follow(%User{} = follower, %User{info: info} = followed) do def follow(%User{} = follower, %User{info: info} = followed) do
@user_config Application.get_env(:pleroma, :user) user_config Application.get_env(:pleroma, :user)
@deny_follow_blocked Keyword.get(@user_config, :deny_follow_blocked) deny_follow_blocked Keyword.get(user_config, :deny_follow_blocked)
ap_followers = followed.follower_address ap_followers = followed.follower_address
@ -219,7 +219,7 @@ def follow(%User{} = follower, %User{info: info} = followed) do
following?(follower, followed) or info["deactivated"] -> following?(follower, followed) or info["deactivated"] ->
{:error, "Could not follow user: #{followed.nickname} is already on your list."} {:error, "Could not follow user: #{followed.nickname} is already on your list."}
@deny_follow_blocked and blocks?(followed, follower) -> deny_follow_blocked and blocks?(followed, follower) ->
{:error, "Could not follow user: #{followed.nickname} blocked you."} {:error, "Could not follow user: #{followed.nickname} blocked you."}
true -> true ->

View File

@ -243,11 +243,11 @@ def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ tru
end end
def block(blocker, blocked, activity_id \\ nil, local \\ true) do def block(blocker, blocked, activity_id \\ nil, local \\ true) do
@ap_config Application.get_env(:pleroma, :activitypub) ap_config Application.get_env(:pleroma, :activitypub)
@unfollow_blocked Keyword.get(@ap_config, :unfollow_blocked) unfollow_blocked Keyword.get(ap_config, :unfollow_blocked)
@outgoing_blocks Keyword.get(@ap_config, :outgoing_blocks) outgoing_blocks Keyword.get(ap_config, :outgoing_blocks)
with true <- @unfollow_blocked do with true <- unfollow_blocked do
follow_activity = fetch_latest_follow(blocker, blocked) follow_activity = fetch_latest_follow(blocker, blocked)
if follow_activity do if follow_activity do
@ -255,7 +255,7 @@ def block(blocker, blocked, activity_id \\ nil, local \\ true) do
end end
end end
with true <- @outgoing_blocks do with true <- outgoing_blocks do
with block_data <- make_block_data(blocker, blocked, activity_id), with block_data <- make_block_data(blocker, blocked, activity_id),
{:ok, activity} <- insert(block_data, local), {:ok, activity} <- insert(block_data, local),
:ok <- maybe_federate(activity) do :ok <- maybe_federate(activity) do