Update pleroma.nginx
[akkoma] / lib / pleroma / formatter.ex
index a708a275e881fd431de67470b7a091f9e6dcc4b5..df7ffbc4165bdc45bcce98401b04cf72e1aafb9e 100644 (file)
@@ -160,6 +160,7 @@ defmodule Pleroma.Formatter do
     links =
       Regex.scan(@link_regex, text)
       |> Enum.map(fn [url] -> {Ecto.UUID.generate(), url} end)
+      |> Enum.sort_by(fn {_, url} -> -String.length(url) end)
 
     uuid_text =
       links
@@ -169,8 +170,11 @@ defmodule Pleroma.Formatter do
       subs ++
         Enum.map(links, fn {uuid, url} ->
           {:safe, link} = Phoenix.HTML.Link.link(url, to: url)
-          link = link
-          |> IO.iodata_to_binary
+
+          link =
+            link
+            |> IO.iodata_to_binary()
+
           {uuid, link}
         end)
 
@@ -196,7 +200,9 @@ defmodule Pleroma.Formatter do
           ap_id = info["source_data"]["url"] || ap_id
 
           short_match = String.split(match, "@") |> tl() |> hd()
-          {uuid, "<span><a href='#{ap_id}'>@<span>#{short_match}</span></a></span>"}
+
+          {uuid,
+           "<span><a class='mention' href='#{ap_id}'>@<span>#{short_match}</span></a></span>"}
         end)
 
     {subs, uuid_text}