rename ftl_removal to federated_timeline_removal to keep consistent naming with Simpl...
[akkoma] / lib / pleroma / formatter.ex
index 2696f41c00fa653f94559f198b84280f7b9872bf..386096a52b2ad4dfbf94ccf32685b1b734fd8ac2 100644 (file)
@@ -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,
-           "<span><a data-user='#{id}' class='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}
@@ -178,7 +184,7 @@ defmodule Pleroma.Formatter do
       subs ++
         Enum.map(tags, fn {tag_text, tag, uuid} ->
           url =
-            "<a data-tag='#{tag}' href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{
+            "<a class='hashtag' data-tag='#{tag}' href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{
               tag_text
             }</a>"