Compare commits

...

1 Commits

Author SHA1 Message Date
Egor Kislitsyn
effcc52ffd
Don't expose remote accounts to search engines 2020-03-12 22:19:33 +04:00
6 changed files with 14 additions and 8 deletions

View File

@ -34,10 +34,12 @@ defmodule Pleroma.Formatter do
ap_id = get_ap_id(user)
nickname_text = get_nickname_text(nickname, opts)
rel = if user.local, do: "ugc", else: "ugc canonical"
link =
~s(<span class="h-card"><a data-user="#{id}" class="u-url mention" href="#{ap_id}" rel="ugc">@<span>#{
nickname_text
}</span></a></span>)
~s(<span class="h-card"><a data-user="#{id}" class="u-url mention" href="#{ap_id}" rel="#{
rel
}">@<span>#{nickname_text}</span></a></span>)
{link, %{acc | mentions: MapSet.put(acc.mentions, {"@" <> nickname, user})}}

View File

@ -26,7 +26,8 @@ defmodule Pleroma.HTML.Scrubber.Default do
"nofollow",
"noopener",
"noreferrer",
"ugc"
"ugc",
"ugc canonical"
])
Meta.allow_tag_with_these_attributes(:a, ["name", "title"])

View File

@ -19,7 +19,8 @@ defmodule Pleroma.HTML.Scrubber.LinksOnly do
"noopener",
"noreferrer",
"me",
"ugc"
"ugc",
"ugc canonical"
])
Meta.allow_tag_with_these_attributes(:a, ["name", "title"])

View File

@ -26,7 +26,9 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do
"tag",
"nofollow",
"noopener",
"noreferrer"
"noreferrer",
"ugc",
"ugc canonical"
])
Meta.allow_tag_with_these_attributes(:a, ["name", "title"])

View File

@ -173,7 +173,7 @@ defmodule Pleroma.FormatterTest do
expected_text =
~s(<span class="h-card"><a data-user="#{mike.id}" class="u-url mention" href="#{
mike.ap_id
}" rel="ugc">@<span>mike</span></a></span> test)
}" rel="ugc canonical">@<span>mike</span></a></span> test)
assert expected_text == text
end

View File

@ -1411,7 +1411,7 @@ defmodule Pleroma.UserTest do
expected_text =
~s(A.k.a. <span class="h-card"><a data-user="#{remote_user.id}" class="u-url mention" href="#{
remote_user.ap_id
}" rel="ugc">@<span>nick@domain.com</span></a></span>)
}" rel="ugc canonical">@<span>nick@domain.com</span></a></span>)
assert expected_text == User.parse_bio(bio, user)
end