mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Don't strip fallbacks on plain text bodies
This commit is contained in:
parent
cfcdc23d4a
commit
33403d650a
1 changed files with 7 additions and 13 deletions
|
@ -585,22 +585,16 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
|
|
||||||
auto ascent = QFontMetrics(UserSettings::instance()->font()).ascent();
|
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));
|
auto formattedBody_ = QString::fromStdString(formatted_body(event));
|
||||||
if (formattedBody_.isEmpty()) {
|
if (formattedBody_.isEmpty()) {
|
||||||
auto body_ = QString::fromStdString(body(event));
|
// NOTE(Nico): replies without html can't have a fallback. If they do, eh, who cares.
|
||||||
|
formattedBody_ = QString::fromStdString(body(event))
|
||||||
if (isReply) {
|
.toHtmlEscaped()
|
||||||
while (body_.startsWith(QLatin1String("> ")))
|
.replace('\n', QLatin1String("<br>"));
|
||||||
body_ = body_.right(body_.size() - body_.indexOf('\n') - 1);
|
} else if (isReply) {
|
||||||
if (body_.startsWith('\n'))
|
formattedBody_ = formattedBody_.remove(replyFallback);
|
||||||
body_ = body_.right(body_.size() - 1);
|
|
||||||
}
|
|
||||||
formattedBody_ = body_.toHtmlEscaped().replace('\n', QLatin1String("<br>"));
|
|
||||||
} else {
|
|
||||||
if (isReply)
|
|
||||||
formattedBody_ = formattedBody_.remove(replyFallback);
|
|
||||||
}
|
}
|
||||||
formattedBody_ = utils::escapeBlacklistedHtml(formattedBody_);
|
formattedBody_ = utils::escapeBlacklistedHtml(formattedBody_);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue