projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
67b4297
)
[#483] User.get_by_nickname/1: allowed retrieving user by fully-qualified local nickname
author
Ivan Tashkinov
<ivantashkinov@gmail.com>
Sat, 29 Dec 2018 09:15:46 +0000
(12:15 +0300)
committer
Ivan Tashkinov
<ivantashkinov@gmail.com>
Sat, 29 Dec 2018 09:15:46 +0000
(12:15 +0300)
(<nick>@<our_instance_host>).
lib/pleroma/user.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index 5580147609100af72856239126aaecf451e421aa..d4a6b13fb51676bc789f4dc02f0150944d7a5234 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-387,7
+387,11
@@
defmodule Pleroma.User 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