Fix reply not closing

fixes #124
This commit is contained in:
Nicolas Werner 2020-04-13 16:22:30 +02:00
parent 82ec022f9c
commit dcddea6fb8
14 changed files with 133 additions and 334 deletions

View file

@ -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;
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());
// 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;
// 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;
}
}