Commit b3574dcc authored by Ivan Tashkinov's avatar Ivan Tashkinov

[#483] User.get_by_nickname/1: allowed retrieving user by fully-qualified local nickname

(<nick>@<our_instance_host>).
parent 67b4297f
......@@ -387,7 +387,11 @@ def get_cached_by_nickname(nickname) do
end
def get_by_nickname(nickname) do
Repo.get_by(User, nickname: nickname)
Repo.get_by(User, nickname: nickname) ||
if String.ends_with?(nickname, "@" <> Pleroma.Web.Endpoint.host()) do
[local_nickname, _] = String.split(nickname, "@")
Repo.get_by(User, nickname: local_nickname)
end
end
def get_by_nickname_or_email(nickname_or_email) do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment