Fix tests.
This commit is contained in:
parent
c7be7a9454
commit
847cb15626
2 changed files with 9 additions and 2 deletions
|
@ -458,4 +458,12 @@ defmodule Pleroma.User do
|
||||||
|
|
||||||
def ap_enabled?(%User{info: info}), do: info["ap_enabled"]
|
def ap_enabled?(%User{info: info}), do: info["ap_enabled"]
|
||||||
def ap_enabled?(_), do: false
|
def ap_enabled?(_), do: false
|
||||||
|
|
||||||
|
def get_or_fetch(uri_or_nickname) do
|
||||||
|
if String.starts_with?(uri_or_nickname, "http") do
|
||||||
|
get_or_fetch_by_ap_id(uri_or_nickname)
|
||||||
|
else
|
||||||
|
get_or_fetch_by_nickname(uri_or_nickname)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -328,8 +328,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_external_profile(for_user, uri) do
|
def get_external_profile(for_user, uri) do
|
||||||
IO.inspect(uri)
|
with %User{} = user <- User.get_or_fetch(uri) do
|
||||||
with %User{} = user <- User.get_or_fetch_by_nickname(uri) do
|
|
||||||
spawn(fn ->
|
spawn(fn ->
|
||||||
with url <- user.info["topic"],
|
with url <- user.info["topic"],
|
||||||
{:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do
|
{:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do
|
||||||
|
|
Loading…
Reference in a new issue