def get_by_nickname(nickname) do
Repo.get_by(User, nickname: nickname) ||
if Regex.match?(~r(@#{Pleroma.Web.Endpoint.host()})i, nickname) do
- [local_nickname, _] = String.split(nickname, "@")
- Repo.get_by(User, nickname: local_nickname)
+ Repo.get_by(User, nickname: local_nickname(nickname))
end
end
end)
bio
- |> CommonUtils.format_input(mentions, tags, "text/plain")
+ |> CommonUtils.format_input(mentions, tags, "text/plain", user_links: [format: :full])
|> Formatter.emojify(emoji)
end
end
end
+ def local_nickname(nickname_or_mention) do
+ nickname_or_mention
+ |> full_nickname()
+ |> String.split("@")
+ |> hd()
+ end
+
+ def full_nickname(nickname_or_mention),
+ do: String.trim_leading(nickname_or_mention, "@")
+
def error_user(ap_id) do
%User{
name: ap_id,