Bugfix. Remove seen call notifications from the list.
authoralex-z <blackslayer4@gmail.com>
Wed, 20 Mar 2024 20:17:06 +0000 (21:17 +0100)
committerallexzander <allexzander@users.noreply.github.com>
Tue, 2 Apr 2024 11:19:34 +0000 (13:19 +0200)
Signed-off-by: alex-z <blackslayer4@gmail.com>
src/gui/tray/activitylistmodel.cpp
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h

index d0866c440c506541f0130e9f3e2b6c69ff262a3c..3976e9950c3c517a66f01bef781d39da9de576ce 100644 (file)
@@ -688,7 +688,9 @@ void ActivityListModel::checkAndRemoveSeenActivities(const OCC::ActivityList &ne
 {
     ActivityList activitiesToRemove;
     for (const auto &activity : _finalList) {
-        if (activity._objectType == QStringLiteral("chat") && !newActivities.contains(activity)) {
+        const auto isTalkActiity = activity._objectType == QStringLiteral("chat") ||
+            activity._objectType == QStringLiteral("call");
+        if (isTalkActiity && !newActivities.contains(activity)) {
             activitiesToRemove.push_back(activity);
         }
     }
index da175d3e28bf82137609ea7cef535d043c975015..7cb3b08e7afa73d88494273323cd64a79907603c 100644 (file)
@@ -119,12 +119,12 @@ bool User::canShowNotification(const long notificationId)
             !notificationAlreadyShown(notificationId);
 }
 
-void User::checkAndRemoveSeenActivities(const ActivityList &list, const int numChatNotificationsReceived)
+void User::checkAndRemoveSeenActivities(const ActivityList &list, const int numTalkNotificationsReceived)
 {
-    if (numChatNotificationsReceived < _lastChatNotificationsReceivedCount) {
+    if (numTalkNotificationsReceived < _lastTalkNotificationsReceivedCount) {
         _activityModel->checkAndRemoveSeenActivities(list);
     }
-    _lastChatNotificationsReceivedCount = numChatNotificationsReceived;
+    _lastTalkNotificationsReceivedCount = numTalkNotificationsReceived;
 }
 
 void User::showDesktopNotification(const QString &title, const QString &message, const long notificationId)
@@ -205,10 +205,11 @@ void User::showDesktopTalkNotification(const Activity &activity)
 
 void User::slotBuildNotificationDisplay(const ActivityList &list)
 {
-    const auto chatNotificationsReceivedCount = std::count_if(std::cbegin(list), std::cend(list), [](const auto &activity) {
-        return activity._objectType == QStringLiteral("chat");
+    const auto talkNotificationsReceivedCount = std::count_if(std::cbegin(list), std::cend(list), [](const auto &activity) {
+        return activity._objectType == QStringLiteral("chat") ||
+            activity._objectType == QStringLiteral("call");
     });
-    checkAndRemoveSeenActivities(list, chatNotificationsReceivedCount);
+    checkAndRemoveSeenActivities(list, talkNotificationsReceivedCount);
 
     ActivityList toNotifyList;
 
index c92e98b7c938a86f804e1bb1e28530e3c3b504b4..37f039f3a79be93f892609637282392a5c0fb657 100644 (file)
@@ -166,7 +166,7 @@ private:
     bool notificationAlreadyShown(const long notificationId);
     bool canShowNotification(const long notificationId);
 
-    void checkAndRemoveSeenActivities(const ActivityList &list, const int numChatNotificationsReceived);
+    void checkAndRemoveSeenActivities(const ActivityList &list, const int numTalkNotificationsReceived);
 
     AccountStatePtr _account;
     bool _isCurrentUser;
@@ -188,7 +188,7 @@ private:
     // no query for notifications is started.
     int _notificationRequestsRunning = 0;
 
-    int _lastChatNotificationsReceivedCount = 0;
+    int _lastTalkNotificationsReceivedCount = 0;
 
     bool _isNotificationFetchRunning = false;
 };