test
This commit is contained in:
parent
533b81d2d0
commit
908ad46f30
@ -5,10 +5,6 @@ module FormattingHelper
|
||||
HtmlAwareFormatter.new(text, local, options).to_s
|
||||
end
|
||||
|
||||
def quotify(html, status, text, local, options = {})
|
||||
QuoteFormatter.new(html, status, text, local, options).to_s
|
||||
end
|
||||
|
||||
def linkify(text, options = {})
|
||||
TextFormatter.new(text, options).to_s
|
||||
end
|
||||
@ -19,7 +15,7 @@ module FormattingHelper
|
||||
module_function :extract_status_plain_text
|
||||
|
||||
def status_content_format(status)
|
||||
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
|
||||
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []),quote: status.respond_to?(:quote) && status.quote,)
|
||||
end
|
||||
|
||||
def account_bio_format(account)
|
||||
|
@ -31,7 +31,7 @@ class TextFormatter
|
||||
end
|
||||
|
||||
def to_s
|
||||
return ''.html_safe if text.blank?
|
||||
return ''.html_safe if text.blank? & !quote?
|
||||
|
||||
html = rewrite do |entity|
|
||||
if entity[:url]
|
||||
@ -43,6 +43,8 @@ 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
|
||||
@ -126,6 +128,14 @@ class TextFormatter
|
||||
HTML
|
||||
end
|
||||
|
||||
def render_quote
|
||||
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 entity_cache
|
||||
@entity_cache ||= EntityCache.instance
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user