Merge branch 'develop' of ssh://git.pleroma.social:2222/pleroma/pleroma into froth

This commit is contained in:
Sam Therapy 2022-11-01 19:46:54 +01:00
commit febfc7e62b
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
2 changed files with 9 additions and 1 deletions

View file

@ -2126,7 +2126,8 @@ def ap_enabled?(_), do: false
@doc "Gets or fetch a user by uri or nickname."
@spec get_or_fetch(String.t()) :: {:ok, User.t()} | {:error, String.t()}
def get_or_fetch("http" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
def get_or_fetch("http://" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
def get_or_fetch("https://" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
def get_or_fetch(nickname), do: get_or_fetch_by_nickname(nickname)
# wait a period of time and return newest version of the User structs

View file

@ -850,6 +850,13 @@ test "gets an existing user by ap_id" do
freshed_user = refresh_record(user)
assert freshed_user == fetched_user
end
test "gets an existing user by nickname starting with http" do
user = insert(:user, nickname: "httpssome")
{:ok, fetched_user} = User.get_or_fetch("httpssome")
assert user == fetched_user
end
end
describe "fetching a user from nickname or trying to build one" do