This commit is contained in:
YoheiZuho 2022-05-16 13:01:06 +09:00
parent ecb99b433e
commit 533b81d2d0
2 changed files with 7 additions and 14 deletions

View File

@ -10,12 +10,11 @@ class QuoteFormatter
end end
def to_s def to_s
def render_quote url = ActivityPub::TagManager.instance.url_for(status.quote)
link = link_to_url({ url: ap_tag_manager.url_for(quote) }) link = encode_and_link_urls(url)
<<~HTML.squish <<~HTML.squish
<span class="quote-inline"><br/>~~~~~~~~~~<br/>[#{link}]</span> <span class="quote-inline"><br/>QT: #{link}</span>"
HTML HTML
end
end end
def format_in_quote(status, **options) def format_in_quote(status, **options)

View File

@ -31,7 +31,7 @@ class TextFormatter
end end
def to_s def to_s
return ''.html_safe if text.blank? & !quote? return ''.html_safe if text.blank?
html = rewrite do |entity| html = rewrite do |entity|
if entity[:url] if entity[:url]
@ -43,8 +43,6 @@ class TextFormatter
end end
end end
html += quotify if quote?
html = simple_format(html, {}, sanitize: false).delete("\n") if multiline? html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
html.html_safe # rubocop:disable Rails/OutputSafety html.html_safe # rubocop:disable Rails/OutputSafety
@ -120,7 +118,7 @@ class TextFormatter
return "@#{h(entity[:screen_name])}" if account.nil? return "@#{h(entity[:screen_name])}" if account.nil?
url = ap_tag_manager.url_for(account) url = ActivityPub::TagManager.instance.url_for(account)
display_username = same_username_hits&.positive? || with_domains? ? account.pretty_acct : account.username display_username = same_username_hits&.positive? || with_domains? ? account.pretty_acct : account.username
<<~HTML.squish <<~HTML.squish
@ -136,10 +134,6 @@ class TextFormatter
@tag_manager ||= TagManager.instance @tag_manager ||= TagManager.instance
end end
def ap_tag_manager
@ap_tag_manager ||= ActivityPub::TagManager.instance
end
delegate :local_domain?, to: :tag_manager delegate :local_domain?, to: :tag_manager
def multiline? def multiline?