[#483] User.get_by_nickname/1: allowed retrieving user by fully-qualified local nickname
(<nick>@<our_instance_host>).
This commit is contained in:
parent
67b4297f4d
commit
b3574dccbb
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue