From a6e4a0abcf79069c5e7f3baa448fb64dea7bf628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Fri, 28 May 2021 10:52:41 +0200 Subject: [PATCH] Fix the quote algorythm, don't trim the lines and stop at the first quote --- app/widgets/Chat/Chat.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/widgets/Chat/Chat.php b/app/widgets/Chat/Chat.php index 9ef1b169c..464e7ff7b 100644 --- a/app/widgets/Chat/Chat.php +++ b/app/widgets/Chat/Chat.php @@ -1111,14 +1111,16 @@ class Chat extends \Movim\Widget\Base } } else { // Let's try to support "quoted" messages - $quote = '>'; + $quote = '> '; $parent = ''; $remains = ''; + $endOfQuote = false; foreach (explode(PHP_EOL, $message->body) as $line) { - if (substr($line, 0, strlen($quote)) == $quote) { - $parent .= trim(substr($line, strlen($quote)))."\n"; + if (substr($line, 0, strlen($quote)) == $quote && $endOfQuote == false) { + $parent .= substr($line, strlen($quote))."\n"; } else { + $endOfQuote = true; $remains .= $line."\n"; } }