X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fformatter.ex;h=f31aafa0dbd3f530a767619f5b81cc39751a4542;hb=b7bc666200d6cd113365af7456b4135c86f1db03;hp=9e50ea3f4a700d5a85eca17602cf5e6bf9fb87eb;hpb=74346a7035d950ede143d65f8364194cb116aaf5;p=akkoma
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index 9e50ea3f4..f31aafa0d 100644
--- a/lib/pleroma/formatter.ex
+++ b/lib/pleroma/formatter.ex
@@ -3,10 +3,10 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Formatter do
+ alias Pleroma.Emoji
+ alias Pleroma.HTML
alias Pleroma.User
alias Pleroma.Web.MediaProxy
- alias Pleroma.HTML
- alias Pleroma.Emoji
@tag_regex ~r/((?<=[^&])|\A)(\#)(\w+)/u
@markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/
@@ -130,7 +130,7 @@ defmodule Pleroma.Formatter do
end
@doc "Adds the links to mentioned users"
- def add_user_links({subs, text}, mentions) do
+ def add_user_links({subs, text}, mentions, options \\ []) do
mentions =
mentions
|> Enum.sort_by(fn {name, _} -> -String.length(name) end)
@@ -152,12 +152,16 @@ defmodule Pleroma.Formatter do
ap_id
end
- short_match = String.split(match, "@") |> tl() |> hd()
+ nickname =
+ if options[:format] == :full do
+ User.full_nickname(match)
+ else
+ User.local_nickname(match)
+ end
{uuid,
- "@#{
- short_match
- }"}
+ "" <>
+ "@#{nickname}"}
end)
{subs, uuid_text}