summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-10-03 21:49:02 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-10-03 21:53:10 +0200
commit33403d650a0fce3d2d85b41e1f27d7141b4721f6 (patch)
tree4b5bd255b5214ce28aecaa73b24d98aa52870c49 /src
parentMerge pull request #1201 from Nheko-Reborn/eoUpdates (diff)
downloadnheko-33403d650a0fce3d2d85b41e1f27d7141b4721f6.tar.xz
Don't strip fallbacks on plain text bodies
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineModel.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index 5232f16c..7c718ca8 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -585,22 +585,16 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r auto ascent = QFontMetrics(UserSettings::instance()->font()).ascent(); - bool isReply = utils::isReply(event); + bool isReply = mtx::accessors::relations(event).reply_to(false).has_value(); auto formattedBody_ = QString::fromStdString(formatted_body(event)); if (formattedBody_.isEmpty()) { - auto body_ = QString::fromStdString(body(event)); - - if (isReply) { - while (body_.startsWith(QLatin1String("> "))) - body_ = body_.right(body_.size() - body_.indexOf('\n') - 1); - if (body_.startsWith('\n')) - body_ = body_.right(body_.size() - 1); - } - formattedBody_ = body_.toHtmlEscaped().replace('\n', QLatin1String("<br>")); - } else { - if (isReply) - formattedBody_ = formattedBody_.remove(replyFallback); + // NOTE(Nico): replies without html can't have a fallback. If they do, eh, who cares. + formattedBody_ = QString::fromStdString(body(event)) + .toHtmlEscaped() + .replace('\n', QLatin1String("<br>")); + } else if (isReply) { + formattedBody_ = formattedBody_.remove(replyFallback); } formattedBody_ = utils::escapeBlacklistedHtml(formattedBody_);