From cf9a542f7409640041c0cf000cb3c768e864118f Mon Sep 17 00:00:00 2001 From: Black Hat Date: Sun, 21 Jul 2019 21:08:37 +0800 Subject: [PATCH] Highlight reactions sent by local user. --- imports/Spectral/Component/Timeline/ReactionDelegate.qml | 2 +- src/messageeventmodel.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/imports/Spectral/Component/Timeline/ReactionDelegate.qml b/imports/Spectral/Component/Timeline/ReactionDelegate.qml index 0ac17e324..1a282d7c5 100644 --- a/imports/Spectral/Component/Timeline/ReactionDelegate.qml +++ b/imports/Spectral/Component/Timeline/ReactionDelegate.qml @@ -15,7 +15,7 @@ RowLayout { background: Rectangle { radius: height / 2 - color: MPalette.banner + color: modelData.hasLocalUser ? (MSettings.darkTheme ? Qt.darker(MPalette.accent, 1.55) : Qt.lighter(MPalette.accent, 1.55)) : MPalette.banner } contentItem: Label { diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index bffae7ca2..d836cc13e 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -500,9 +500,12 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const { for (auto author : i.value()) { authors.append(QVariant::fromValue(author)); } + bool hasLocalUser = i.value().contains( + static_cast(m_currentRoom->localUser())); res.append(QVariantMap{{"reaction", i.key()}, {"count", i.value().count()}, - {"authors", authors}}); + {"authors", authors}, + {"hasLocalUser", hasLocalUser}}); ++i; }