From: Roger Braun Date: Fri, 12 May 2017 16:50:47 +0000 (+0200) Subject: Fetch user on externalprofile if we don't know him X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=04544da8f1f8f7e8f2f629c7b6d8cc09e1c03618;p=akkoma Fetch user on externalprofile if we don't know him --- diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index d048d07c3..6503d7222 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -2,6 +2,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do alias Pleroma.{User, Activity, Repo, Object} alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.TwitterAPI.Representers.{ActivityRepresenter, UserRepresenter} + alias Pleroma.Web.OStatus import Ecto.Query @@ -352,10 +353,10 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do end def get_external_profile(for_user, uri) do - with %User{} = user <- User.get_cached_by_ap_id(uri) do + with {:ok, %User{} = user} <- OStatus.find_or_make_user(uri) do {:ok, UserRepresenter.to_map(user, %{for: for_user})} else _e -> - {:error, "Couldn't find user"} + {:error, "Couldn't find user"} end end end