Create function for processing whether a message is a reply

This commit is contained in:
Loren Burkholder 2021-02-20 13:05:21 -05:00 committed by Nicolas Werner
parent d8fb4d9292
commit 39576fea96
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 11 additions and 1 deletions

View file

@ -24,6 +24,7 @@
#include "Cache.h"
#include "Config.h"
#include "EventAccessors.h"
#include "MatrixClient.h"
#include "UserSettingsPage.h"
@ -696,3 +697,9 @@ utils::readImage(const QByteArray *data)
reader.setAutoTransform(true);
return reader.read();
}
bool
utils::isReply(const mtx::events::collections::TimelineEvents &e)
{
return mtx::accessors::relations(e).reply_to().has_value();
}

View file

@ -310,4 +310,7 @@ restoreCombobox(QComboBox *combo, const QString &value);
//! Read image respecting exif orientation
QImage
readImage(const QByteArray *data);
bool
isReply(const mtx::events::collections::TimelineEvents &e);
}

View file

@ -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()) {