summaryrefslogtreecommitdiffstats
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-12-28 21:43:43 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-12-28 21:57:57 +0100
commit114fa0868a6fc4ed2762bccde5181d8be5559e4f (patch)
treedcf3d3d2fc6942644e070abba58075963d52b0b2 /src/ChatPage.cpp
parent35673b5b52b28f4f07ae0f5ec50a8b1c76d24038 (diff)
Skip notifying for your own messages
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r--src/ChatPage.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index bcb89a03..27019ba3 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -266,6 +266,18 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
relatedEvents;
for (const auto &event : room.timeline.events) {
+ auto event_id = mtx::accessors::event_id(event);
+
+ // skip already read events
+ if (currentReadMarker &&
+ currentReadMarker > cache::getEventIndex(room_id, event_id))
+ continue;
+
+ // skip our messages
+ auto sender = mtx::accessors::sender(event);
+ if (sender == http::client()->user_id().to_string())
+ continue;
+
mtx::events::collections::TimelineEvent te{event};
std::visit([room_id = room_id](auto &event_) { event_.room_id = room_id; },
te.data);
@@ -304,13 +316,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent)
actions.end(),
mtx::pushrules::actions::Action{
mtx::pushrules::actions::notify{}}) != actions.end()) {
- auto event_id = mtx::accessors::event_id(event);
-
- // skip already read events
- if (currentReadMarker &&
- currentReadMarker > cache::getEventIndex(room_id, event_id))
- continue;
-
if (!cache::isNotificationSent(event_id)) {
// We should only send one notification per event.
cache::markSentNotification(event_id);