]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
follow shouldNotify flag to hide notifications when needed
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 16 Mar 2023 20:28:22 +0000 (21:28 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 21 Mar 2023 08:10:12 +0000 (09:10 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/tray/activitydata.h
src/gui/tray/notificationhandler.cpp
src/gui/tray/usermodel.cpp

index 947cea5fb7c265de80c207412e33d51548ef3394..c4e8947240a706e7bde5c3fcea06a8da3ab3c288 100644 (file)
@@ -157,6 +157,7 @@ public:
      * @return
      */
 
+    bool _shouldNotify = true;
 
     [[nodiscard]] Identifier ident() const;
 };
index d0fc7b4c88291400b6119d2b0ac3d4b97b76abd8..f87a717b77d5b7e043f2af241487f937b1d6a881 100644 (file)
@@ -105,6 +105,10 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
             }
         }
 
+        if (json.contains("shouldNotify")) {
+            a._shouldNotify = json.value("shouldNotify").toBool(true);
+        }
+
         // 2 cases to consider:
         // 1. server == 24 & has Talk: object_type is chat/call/room & object_id contains conversationToken/messageId
         // 2. server < 24 & has Talk: object_type is chat/call/room & object_id contains _only_ conversationToken
index 5c6f24e5f3ae0491fd0b3ffd4d48c60bb3b36f17..deae25c513d332c096b65a61e5fa1dc13a5f6c9b 100644 (file)
@@ -193,6 +193,10 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)
             qCInfo(lcActivity) << "Activity already notified, skip";
             return false;
         }
+        if (!activity._shouldNotify) {
+            qCDebug(lcActivity) << "Activity should not be notified";
+            return false;
+        }
 
         return true;
     });
@@ -226,6 +230,11 @@ void User::slotBuildIncomingCallDialogs(const ActivityList &list)
 
     if(systray) {
         for(const auto &activity : list) {
+            if (!activity._shouldNotify) {
+                qCDebug(lcActivity) << "Activity should not be notified";
+                continue;
+            }
+
             systray->createCallDialog(activity, _account);
         }
     }