diff options
| -rw-r--r-- | lib/pleroma/formatter.ex | 7 | ||||
| -rw-r--r-- | test/formatter_test.exs | 4 | ||||
| -rw-r--r-- | test/web/twitter_api/views/user_view_test.exs | 2 | 
3 files changed, 6 insertions, 7 deletions
| diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 4149265a2..024c6e117 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -142,12 +142,11 @@ defmodule Pleroma.Formatter do                ap_id              end -          short_match = String.split(match, "@") |> tl() |> hd() +          full_match = String.trim_leading(match, "@")            {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>#{full_match}</span></a></span>"}          end)      {subs, uuid_text} diff --git a/test/formatter_test.exs b/test/formatter_test.exs index bd8844458..7040f1c27 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -150,7 +150,7 @@ defmodule Pleroma.FormatterTest do            archaeme.id          }' class='u-url mention' href='#{"https://archeme/@archa_eme_"}'>@<span>archa_eme_</span></a></span>, that is @daggsy. Also hello <span class='h-card'><a data-user='#{            archaeme_remote.id -        }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme</span></a></span>" +        }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme@archae.me</span></a></span>"        assert expected_text == Formatter.finalize({subs, text})      end @@ -168,7 +168,7 @@ defmodule Pleroma.FormatterTest do        Enum.each(subs, fn {uuid, _} -> assert String.contains?(text, uuid) end)        expected_text = -        "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike</span></a></span> test" +        "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike@osada.macgirvin.com</span></a></span> test"        assert expected_text == Formatter.finalize({subs, text})      end diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index 5f7481eb6..b8f1afa76 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -12,7 +12,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do    import Pleroma.Factory    setup do -    user = insert(:user, bio: "<span>Here's some html</span>") +    user = insert(:user, bio: "<span>Here's some html,</span> @mention@domain.com")      [user: user]    end | 
