fix show preview card on QT

This commit is contained in:
YoheiZuho 2022-05-01 17:21:39 +09:00
parent 43cda1c44f
commit cc12ddf427

View File

@ -16,4 +16,17 @@ class QuoteFormatter
link = encode_and_link_urls(url) link = encode_and_link_urls(url)
html.sub(/(<[^>]+>)\z/, "<span class=\"quote-inline\"><br/>QT: #{link}</span>\\1") html.sub(/(<[^>]+>)\z/, "<span class=\"quote-inline\"><br/>QT: #{link}</span>\\1")
end end
def format_in_quote(status, **options)
# format_in_quoteを定義、引数statusと**options
html = format(status)
return '' if html.empty?
doc = Nokogiri::HTML.parse(html, nil, 'utf-8')
html = doc.css('body')[0].inner_html
html.sub!(/^<p>(.+)<\/p>$/, '\1')
html = Sanitize.clean(html).delete("\n").truncate(150)
html = encode_custom_emojis(html, status.emojis) if options[:custom_emojify]
html.html_safe
end
end end