summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-02-20 13:05:21 -0500
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-17 19:17:15 +0100
commit39576fea96c6cac275addc1602f1cc5af464f745 (patch)
treebfc3d97bbead26d0652693af7670bd8eb042991f /src
parentSimplify message body construction (diff)
downloadnheko-39576fea96c6cac275addc1602f1cc5af464f745.tar.xz
Create function for processing whether a message is a reply
Diffstat (limited to 'src')
-rw-r--r--src/Utils.cpp7
-rw-r--r--src/Utils.h3
-rw-r--r--src/timeline/TimelineModel.cpp2
3 files changed, 11 insertions, 1 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp

index 5c03c52f..40c16fd3 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp
@@ -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(); +} diff --git a/src/Utils.h b/src/Utils.h
index 373bed01..1dc5ffd6 100644 --- a/src/Utils.h +++ b/src/Utils.h
@@ -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); } diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 004cf26a..cfca626a 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()) {