X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fformatter.ex;h=f31aafa0dbd3f530a767619f5b81cc39751a4542;hb=b7bc666200d6cd113365af7456b4135c86f1db03;hp=2696f41c00fa653f94559f198b84280f7b9872bf;hpb=997f4a5e09f8531f95ba3f13986b9dda583d046a;p=akkoma
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index 2696f41c0..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,10 +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}
@@ -178,7 +184,7 @@ defmodule Pleroma.Formatter do
subs ++
Enum.map(tags, fn {tag_text, tag, uuid} ->
url =
- "#{
+ "#{
tag_text
}"