Check if the user has indeed not been federated with
authorEkaterina Vaartis <vaartis@cock.li>
Mon, 18 Mar 2019 17:14:49 +0000 (20:14 +0300)
committerEkaterina Vaartis <vaartis@cock.li>
Mon, 18 Mar 2019 17:16:31 +0000 (20:16 +0300)
Just updating the user triggered post fetching too, now it
shouldn't. It only happened in the AP user fetching since that's
what's used to update users

lib/pleroma/user.ex

index 692ae836c36ff0d265c6fa0e39a053e48eb56d0b..f72bc4bce8426ab2915535e9892a8c8089c34cd7 100644 (file)
@@ -1159,9 +1159,12 @@ defmodule Pleroma.User do
     if !is_nil(user) and !User.needs_update?(user) do
       user
     else
+      # Whether to fetch initial posts for the user (if it's a new user & the fetching is enabled)
+      should_fetch_initial = is_nil(user) and Pleroma.Config.get([:fetch_initial_posts, :enabled])
+
       user = fetch_by_ap_id(ap_id)
 
-      if Pleroma.Config.get([:fetch_initial_posts, :enabled]) do
+      if should_fetch_initial do
         with %User{} = user do
           {:ok, _} = Task.start(__MODULE__, :fetch_initial_posts, [user])
         end