Merge branch 'feature/admin-api/support-token-header' into 'develop'
[akkoma] / lib / pleroma / user.ex
index 40171620ed3901ab60857b17e9490772dc627ac5..fcb1d5143942bc7738aff01ca8ecf70ca7166181 100644 (file)
@@ -124,6 +124,9 @@ defmodule Pleroma.User do
     timestamps()
   end
 
+  @doc "Returns if the user should be allowed to authenticate"
+  def auth_active?(%User{deactivated: true}), do: false
+
   def auth_active?(%User{confirmation_pending: true}),
     do: !Pleroma.Config.get([:instance, :account_activation_required])
 
@@ -1095,7 +1098,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