diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 20a3fe10..8a5e4346 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -302,7 +302,9 @@ InputBar::message(QString msg, MarkdownOverride useMarkdown)
// NOTE(Nico): rich replies always need a formatted_body!
text.format = "org.matrix.custom.html";
- if (ChatPage::instance()->userSettings()->markdown())
+ if ((ChatPage::instance()->userSettings()->markdown() &&
+ useMarkdown == MarkdownOverride::NOT_SPECIFIED) ||
+ useMarkdown == MarkdownOverride::ON)
text.formatted_body =
utils::getFormattedQuoteBody(related, utils::markdownToHtml(msg))
.toStdString();
@@ -572,7 +574,7 @@ InputBar::showPreview(const QMimeData &source, QString path, const QStringList &
auto mimeClass = mime.split("/")[0];
nhlog::ui()->debug("Mime: {}", mime.toStdString());
if (mimeClass == "image") {
- QImage img = utils::readImage(&data);
+ QImage img = utils::readImage(data);
dimensions = img.size();
if (img.height() > 200 && img.width() > 360)
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 004cf26a..8e96cb3e 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -369,7 +369,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
auto ascent = QFontMetrics(UserSettings::instance()->font()).ascent();
- bool isReply = relations(event).reply_to().has_value();
+ bool isReply = utils::isReply(event);
auto formattedBody_ = QString::fromStdString(formatted_body(event));
if (formattedBody_.isEmpty()) {
@@ -870,30 +870,7 @@ TimelineModel::relatedInfo(QString id)
if (!event)
return {};
- RelatedInfo related = {};
- related.quoted_user = QString::fromStdString(mtx::accessors::sender(*event));
- related.related_event = id.toStdString();
- related.type = mtx::accessors::msg_type(*event);
-
- // get body, strip reply fallback, then transform the event to text, if it is a media event
- // etc
- related.quoted_body = QString::fromStdString(mtx::accessors::body(*event));
- QRegularExpression plainQuote("^>.*?$\n?", QRegularExpression::MultilineOption);
- while (related.quoted_body.startsWith(">"))
- related.quoted_body.remove(plainQuote);
- if (related.quoted_body.startsWith("\n"))
- related.quoted_body.remove(0, 1);
- related.quoted_body = utils::getQuoteBody(related);
- related.quoted_body.replace("@room", QString::fromUtf8("@\u2060room"));
-
- // get quoted body and strip reply fallback
- related.quoted_formatted_body = mtx::accessors::formattedBodyWithFallback(*event);
- related.quoted_formatted_body.remove(QRegularExpression(
- "<mx-reply>.*</mx-reply>", QRegularExpression::DotMatchesEverythingOption));
- related.quoted_formatted_body.replace("@room", "@\u2060aroom");
- related.room = room_id_;
-
- return related;
+ return utils::stripReplyFallbacks(*event, id.toStdString(), room_id_);
}
void
|