On user making, check if we have a user with that uri.
authorRoger Braun <roger@rogerbraun.net>
Fri, 12 May 2017 16:58:25 +0000 (18:58 +0200)
committerRoger Braun <roger@rogerbraun.net>
Fri, 12 May 2017 16:58:25 +0000 (18:58 +0200)
lib/pleroma/web/ostatus/ostatus.ex

index 1ac38bd8af16c3c0a90b06bd8215fc3ae720907b..05bc4058ca7f1810b170033ed5e1d07eeae46087 100644 (file)
@@ -235,8 +235,12 @@ defmodule Pleroma.Web.OStatus do
         info: info,
         avatar: info["avatar"]
       }
-      cs = User.remote_user_creation(data)
-      Repo.insert(cs)
+      with %User{} = user <- User.get_by_ap_id(data.ap_id) do
+        {:ok, user}
+      else _e ->
+        cs = User.remote_user_creation(data)
+        Repo.insert(cs)
+      end
     end
   end