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
def to_s
def render_quote
link = link_to_url({ url: ap_tag_manager.url_for(quote) })
<<~HTML.squish
<span class="quote-inline"><br/>~~~~~~~~~~<br/>[#{link}]</span>
HTML
end
url = ActivityPub::TagManager.instance.url_for(status.quote)
link = encode_and_link_urls(url)
<<~HTML.squish
<span class="quote-inline"><br/>QT: #{link}</span>"
HTML
end
def format_in_quote(status, **options)

View File

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