Do not display dismissed notifications
authorRoeland Jago Douma <roeland@famdouma.nl>
Fri, 1 Feb 2019 13:39:59 +0000 (14:39 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Fri, 1 Feb 2019 13:39:59 +0000 (14:39 +0100)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
src/gui/activitylistmodel.cpp
src/gui/activitylistmodel.h
src/gui/activitywidget.cpp

index d74e8597bbbf9bf1356ae006d8deee05509f18b2..5b084784b48c5ead6c793e301e06cc1938c176eb 100644 (file)
@@ -233,6 +233,12 @@ void ActivityListModel::addNotificationToActivityList(Activity activity) {
     combineActivityLists();
 }
 
+void ActivityListModel::clearNotifications() {
+    qCInfo(lcActivity) << "Clear the notifications";
+    _notificationLists.clear();
+    combineActivityLists();
+}
+
 void ActivityListModel::removeActivityFromActivityList(int row) {
     Activity activity =  _finalList.at(row);
     removeActivityFromActivityList(activity);
index 0c7606a0ce5b0e6ce79506f40b7f283c03bb48af..2bffabca1821e0a6f2c3a4d705b2f4c31cbf573f 100644 (file)
@@ -49,6 +49,7 @@ public:
     ActivityList activityList() { return _finalList; }
     ActivityList errorsList() { return _notificationErrorsLists; }
     void addNotificationToActivityList(Activity activity);
+    void clearNotifications();
     void addErrorToActivityList(Activity activity);
     void addSyncFileItemToActivityList(Activity activity);
     void removeActivityFromActivityList(int row);
index 6a58bbd22f57b27fab845a96537bc3d8b034864a..f1cf76d03fd8a75aac80e1573a1a87d6887356fa 100644 (file)
@@ -430,20 +430,17 @@ void ActivityWidget::slotOpenFile(QModelIndex indx)
 // collected.
 void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
 {
-    QString listAccountName;
-
     // Whether a new notification was added to the list
     bool newNotificationShown = false;
 
+    _model->clearNotifications();
+
     foreach (auto activity, list) {
         if (_blacklistedNotifications.contains(activity)) {
             qCInfo(lcActivity) << "Activity in blacklist, skip";
             continue;
         }
 
-        // remember the list account name for the strayCat handling below.
-        listAccountName = activity._accName;
-
         // handle gui logs. In order to NOT annoy the user with every fetching of the
         // notifications the notification id is stored in a Set. Only if an id
         // is not in the set, it qualifies for guiLog.
@@ -468,14 +465,15 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
                     emit guiLog(activity._subject, activity._accName);
                 }
             }
-
-            _model->addNotificationToActivityList(activity);
         }
+
+        _model->addNotificationToActivityList(activity);
     }
 
     // restart the gui log timer now that we show a new notification
-    if(newNotificationShown)
+    if(newNotificationShown) {
         _guiLogTimer.start();
+    }
 }
 
 void ActivityWidget::slotSendNotificationRequest(const QString &accountName, const QString &link, const QByteArray &verb, int row)