Only run the fix-up tasks once.
authorlain <lain@soykaf.club>
Wed, 7 Mar 2018 19:19:48 +0000 (20:19 +0100)
committerlain <lain@soykaf.club>
Wed, 7 Mar 2018 19:19:48 +0000 (20:19 +0100)
lib/pleroma/web/activity_pub/transmogrifier.ex

index 54468b5f9d5f9be8b346e5a3913251969765419c..37db67798aa91d821467f0d5ad806215fb814e89 100644 (file)
@@ -266,16 +266,19 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
       data = data
       |> Map.put(:info, Map.merge(user.info, data[:info]))
 
+      already_ap = User.ap_enabled?(user)
       {:ok, user} = User.upgrade_changeset(user, data)
       |> Repo.update()
 
-      # This could potentially take a long time, do it in the background
-      if async do
-        Task.start(fn ->
+      if !already_ap do
+        # This could potentially take a long time, do it in the background
+        if async do
+          Task.start(fn ->
+            user_upgrade_task(user)
+          end)
+        else
           user_upgrade_task(user)
-        end)
-      else
-        user_upgrade_task(user)
+        end
       end
 
       {:ok, user}