From bef7f9a21cb389f8b722222cc6eb7b816fef2dec Mon Sep 17 00:00:00 2001 From: kyori19 Date: Wed, 11 May 2022 14:05:11 +0000 Subject: [PATCH] Fix quote inline not hidden on WebUI --- app/lib/text_formatter.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/lib/text_formatter.rb b/app/lib/text_formatter.rb index 96696ff8b..b42dc0f60 100644 --- a/app/lib/text_formatter.rb +++ b/app/lib/text_formatter.rb @@ -33,8 +33,7 @@ class TextFormatter end def to_s - append_quote if quote? - return ''.html_safe if text.blank? + return ''.html_safe if text.blank? & !quote? html = rewrite do |entity| if entity[:url] @@ -46,6 +45,8 @@ class TextFormatter end end + html += render_quote if quote? + html = simple_format(html, {}, sanitize: false).delete("\n") if multiline? html.html_safe # rubocop:disable Rails/OutputSafety @@ -129,8 +130,11 @@ class TextFormatter HTML end - def append_quote - @text += "\n[#{ap_tag_manager.url_for(quote)}]" + def render_quote + link = link_to_url({ url: ap_tag_manager.url_for(quote) }) + <<~HTML.squish +
~~~~~~~~~~
[#{link}]
+ HTML end def entity_cache