From cc12ddf427d3c288c5e477f3e6d73089c57c17ef Mon Sep 17 00:00:00 2001 From: YoheiZuho Date: Sun, 1 May 2022 17:21:39 +0900 Subject: [PATCH] fix show preview card on QT --- app/lib/quote_formatter.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/lib/quote_formatter.rb b/app/lib/quote_formatter.rb index 69c5b7456..d51f938b5 100644 --- a/app/lib/quote_formatter.rb +++ b/app/lib/quote_formatter.rb @@ -16,4 +16,17 @@ class QuoteFormatter link = encode_and_link_urls(url) html.sub(/(<[^>]+>)\z/, "
QT: #{link}
\\1") 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>$/, '\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