From: lain Date: Sat, 24 Mar 2018 14:09:09 +0000 (+0100) Subject: Fix tests. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=847cb15626debd15eb50c00bb50113457bed7d1c;p=akkoma Fix tests. --- diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 5da146014..e92b85f52 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -458,4 +458,12 @@ defmodule Pleroma.User do def ap_enabled?(%User{info: info}), do: info["ap_enabled"] 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 diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 61b11681a..6e1f141f3 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -328,8 +328,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do end def get_external_profile(for_user, uri) do - IO.inspect(uri) - with %User{} = user <- User.get_or_fetch_by_nickname(uri) do + with %User{} = user <- User.get_or_fetch(uri) do spawn(fn -> with url <- user.info["topic"], {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do