summary refs log tree commit diff
path: root/src/notifications
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-04-13 16:22:30 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-04-13 16:22:30 +0200
commitdcddea6fb89246d63be91a1f1151ce2dbd255a12 (patch)
tree5d3782b9d7763ab83b0d65d183e37dc29fcd40e6 /src/notifications
parentFix notification not being cleared, when read event didn't cause a notification (diff)
downloadnheko-dcddea6fb89246d63be91a1f1151ce2dbd255a12.tar.xz
Fix reply not closing
fixes #124
Diffstat (limited to 'src/notifications')
-rw-r--r--src/notifications/ManagerLinux.cpp36
-rw-r--r--src/notifications/ManagerWin.cpp1
2 files changed, 18 insertions, 19 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp

index 8b7b41bb..b9eca1a8 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp
@@ -97,24 +97,24 @@ NotificationsManager::closeNotification(uint id) void NotificationsManager::removeNotification(const QString &roomId, const QString &eventId) - - roomEventId reId = {roomId, eventId}; -for (auto elem = notificationIds.begin(); elem != notificationIds.end(); ++elem) { - if (elem.value().roomId != roomId) - continue; - - // close all notifications matching the eventId or having a lower - // notificationId - // This relies on the notificationId not wrapping around. This allows for - // approximately 2,147,483,647 notifications, so it is a bit unlikely. - // Otherwise we would need to store a 64bit counter instead. - closeNotification(elem.key()); - - // FIXME: compare index of event id of the read receipt and the notification instead of just - // the id to prevent read receipts of events without notification clearing all notifications - // in that room! - if (elem.value() == reId) - break; +{ + roomEventId reId = {roomId, eventId}; + for (auto elem = notificationIds.begin(); elem != notificationIds.end(); ++elem) { + if (elem.value().roomId != roomId) + continue; + + // close all notifications matching the eventId or having a lower + // notificationId + // This relies on the notificationId not wrapping around. This allows for + // approximately 2,147,483,647 notifications, so it is a bit unlikely. + // Otherwise we would need to store a 64bit counter instead. + closeNotification(elem.key()); + + // FIXME: compare index of event id of the read receipt and the notification instead + // of just the id to prevent read receipts of events without notification clearing + // all notifications in that room! + if (elem.value() == reId) + break; } } diff --git a/src/notifications/ManagerWin.cpp b/src/notifications/ManagerWin.cpp
index b00bac2e..5e209ee6 100644 --- a/src/notifications/ManagerWin.cpp +++ b/src/notifications/ManagerWin.cpp
@@ -67,4 +67,3 @@ void NotificationsManager::notificationClosed(uint, uint) {} void NotificationsManager::removeNotification(const QString &roomId, const QString &eventId) {} -