Fix comment "pings" (#3038)

pull/3039/head
Samantaz Fox 2022-04-17 18:02:47 +02:00 zatwierdzone przez GitHub
rodzic 21bd4edee4
commit 3702e8c6fe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -602,9 +602,15 @@ def content_to_comment_html(content)
text = %(<a href="/watch?v=#{video_id}">#{"youtube.com/watch?v=#{video_id}"}</a>)
end
elsif url = run.dig?("navigationEndpoint", "commandMetadata", "webCommandMetadata", "url").try &.as_s
if text.starts_with?(/\s?@/)
# Handle "pings" in comments differently
# See: https://github.com/iv-org/invidious/issues/3038
text = %(<a href="#{url}">#{text}</a>)
else
text = %(<a href="#{url}">#{reduce_uri(url)}</a>)
end
end
end
text
end.join("").delete('\ufeff')