projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feature/rich-media-limits' into 'develop'
[akkoma]
/
lib
/
pleroma
/
formatter.ex
diff --git
a/lib/pleroma/formatter.ex
b/lib/pleroma/formatter.ex
index 9e50ea3f4a700d5a85eca17602cf5e6bf9fb87eb..f31aafa0dbd3f530a767619f5b81cc39751a4542 100644
(file)
--- 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
# 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.User
alias Pleroma.Web.MediaProxy
- alias Pleroma.HTML
- alias Pleroma.Emoji
@tag_regex ~r/((?<=[^&])|\A)(\#)(\w+)/u
@markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/
@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"
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)
mentions =
mentions
|> Enum.sort_by(fn {name, _} -> -String.length(name) end)
@@
-152,12
+152,16
@@
defmodule Pleroma.Formatter do
ap_id
end
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,
{uuid,
- "<span class='h-card'><a data-user='#{id}' class='u-url mention' href='#{ap_id}'>@<span>#{
- short_match
- }</span></a></span>"}
+ "<span class='h-card'><a data-user='#{id}' class='u-url mention' href='#{ap_id}'>" <>
+ "@<span>#{nickname}</span></a></span>"}
end)
{subs, uuid_text}
end)
{subs, uuid_text}