forked from AkkomaGang/akkoma
Fetch user on externalprofile if we don't know him
This commit is contained in:
parent
dd12cf7296
commit
04544da8f1
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
alias Pleroma.{User, Activity, Repo, Object}
|
alias Pleroma.{User, Activity, Repo, Object}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Pleroma.Web.TwitterAPI.Representers.{ActivityRepresenter, UserRepresenter}
|
alias Pleroma.Web.TwitterAPI.Representers.{ActivityRepresenter, UserRepresenter}
|
||||||
|
alias Pleroma.Web.OStatus
|
||||||
|
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
|
@ -352,7 +353,7 @@ def conversation_id_to_context(id) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_external_profile(for_user, uri) do
|
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})}
|
{:ok, UserRepresenter.to_map(user, %{for: for_user})}
|
||||||
else _e ->
|
else _e ->
|
||||||
{:error, "Couldn't find user"}
|
{:error, "Couldn't find user"}
|
||||||
|
|
Loading…
Reference in a new issue