From 9c368fa7f448715c2ce04c61097e0cb18091774b Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 27 Jan 2020 17:05:40 +0100 Subject: Fix reply rendering without markdown in riot --- src/timeline/TimelineViewManager.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/timeline/TimelineViewManager.cpp') diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 578d075f..9008d9d2 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -186,8 +186,11 @@ TimelineViewManager::queueTextMessage(const QString &msg, const std::optionalisMarkdownEnabled()) { + text.format = "org.matrix.custom.html"; + text.formatted_body = utils::markdownToHtml(msg).toStdString(); + } if (related) { QString body; @@ -202,14 +205,18 @@ TimelineViewManager::queueTextMessage(const QString &msg, const std::optionalrelated_event; - } - if (!settings->isMarkdownEnabled()) { - text.format = ""; - text.formatted_body = ""; + // NOTE(Nico): rich replies always need a formatted_body! + text.format = "org.matrix.custom.html"; + if (settings->isMarkdownEnabled()) + text.formatted_body = + utils::getFormattedQuoteBody(*related, utils::markdownToHtml(msg)) + .toStdString(); + else + text.formatted_body = + utils::getFormattedQuoteBody(*related, msg.toHtmlEscaped()).toStdString(); + + text.relates_to.in_reply_to.event_id = related->related_event; } if (timeline_) -- cgit 1.5.1