Merge branch 'faster-user-deactivation' into 'develop'

User: Don't pull remote users follower count immediately after deactivating.

Closes #1369

See merge request pleroma/pleroma!1933
This commit is contained in:
kaniini 2019-11-04 14:24:21 +00:00
commit 06cc77e6fb

View file

@ -1095,7 +1095,12 @@ defmodule Pleroma.User do
def deactivate(%User{} = user, status) do def deactivate(%User{} = user, status) do
with {:ok, user} <- set_activation_status(user, status) do with {:ok, user} <- set_activation_status(user, status) do
Enum.each(get_followers(user), &invalidate_cache/1) Enum.each(get_followers(user), &invalidate_cache/1)
Enum.each(get_friends(user), &update_follower_count/1)
# Only update local user counts, remote will be update during the next pull.
user
|> get_friends()
|> Enum.filter(& &1.local)
|> Enum.each(&update_follower_count/1)
{:ok, user} {:ok, user}
end end