From: Ivan Tashkinov Date: Sat, 29 Dec 2018 09:15:46 +0000 (+0300) Subject: [#483] User.get_by_nickname/1: allowed retrieving user by fully-qualified local nickname X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=b3574dccbbb9d24ed90f0a82627d18428aaa7a16;p=akkoma [#483] User.get_by_nickname/1: allowed retrieving user by fully-qualified local nickname (@). --- diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 558014760..d4a6b13fb 100644 --- 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