Merge branch 'hotfix/user_unfollow' into 'develop'

[#1177] fixed User.unfollow with synchronization external user

See merge request pleroma/pleroma!1579
This commit is contained in:
lain 2019-08-19 14:36:10 +00:00
commit 49ae3191df
4 changed files with 83 additions and 20 deletions

View file

@ -53,13 +53,11 @@ defmodule Mix.Tasks.Pleroma.Relay do
def run(["list"]) do
start_pleroma()
with %User{} = user <- Relay.get_actor() do
user.following
|> Enum.each(fn entry ->
URI.parse(entry)
|> Map.get(:host)
|> shell_info()
end)
with %User{following: following} = _user <- Relay.get_actor() do
following
|> Enum.map(fn entry -> URI.parse(entry).host end)
|> Enum.uniq()
|> Enum.each(&shell_info(&1))
else
e -> shell_error("Error while fetching relay subscription list: #{inspect(e)}")
end

View file

@ -750,6 +750,7 @@ defmodule Pleroma.User do
|> update_and_set_cache()
end
@spec maybe_fetch_follow_information(User.t()) :: User.t()
def maybe_fetch_follow_information(user) do
with {:ok, user} <- fetch_follow_information(user) do
user
@ -807,9 +808,10 @@ defmodule Pleroma.User do
end
end
@spec maybe_update_following_count(User.t()) :: User.t()
def maybe_update_following_count(%User{local: false} = user) do
if Pleroma.Config.get([:instance, :external_user_synchronization]) do
{:ok, maybe_fetch_follow_information(user)}
maybe_fetch_follow_information(user)
else
user
end