User: Don't pull remote users follower count immediately after deactivating.
authorlain <lain@soykaf.club>
Mon, 4 Nov 2019 13:36:54 +0000 (14:36 +0100)
committerlain <lain@soykaf.club>
Mon, 4 Nov 2019 13:36:54 +0000 (14:36 +0100)
The other instance doesn't necessarily know that anything changed yet, and it
will be fixed up at the next user pull anyway.

Closes #1369

lib/pleroma/user.ex

index 40171620ed3901ab60857b17e9490772dc627ac5..f8c2db1e1ebc3b1128c288db28f2229970d1c779 100644 (file)
@@ -1095,7 +1095,12 @@ defmodule Pleroma.User do
   def deactivate(%User{} = user, status) do
     with {:ok, user} <- set_activation_status(user, status) do
       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}
     end