summary refs log tree commit diff
path: root/src/notifications/ManagerLinux.cpp
diff options
context:
space:
mode:
authorLcsTen <lcs10.twinoid@gmail.com>2023-03-12 10:35:25 +0100
committerLcsTen <lcs10.twinoid@gmail.com>2023-04-14 19:57:33 +0200
commit818e20513433a38d0104cbc13c68bff5394f505c (patch)
tree67f440e4e529d418e91bbe0127cfa1353d86847a /src/notifications/ManagerLinux.cpp
parentOptimize alphabetical sorting a bit (diff)
downloadnheko-818e20513433a38d0104cbc13c68bff5394f505c.tar.xz
Don't send desktop notifications if there are too many of them at once
Diffstat (limited to '')
-rw-r--r--src/notifications/ManagerLinux.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp
index 6babb447..fc92c9ae 100644
--- a/src/notifications/ManagerLinux.cpp
+++ b/src/notifications/ManagerLinux.cpp
@@ -187,11 +187,14 @@ NotificationsManager::systemPostNotification(const QString &room_id,
     // The list of actions has always the action name and then a localized version of that
     // action. Currently we just use an empty string for that.
     // TODO(Nico): Look into what to actually put there.
-    argumentList << (QStringList(QStringLiteral("default"))
-                     << QLatin1String("") << QStringLiteral("inline-reply")
-                     << QLatin1String("")); // actions
-    argumentList << hints;                  // hints
-    argumentList << (int)-1;                // timeout in ms
+    QStringList actions;
+    actions << QStringList(QStringLiteral("default")) << QLatin1String("");
+    if (!room_id.isEmpty()) {
+        actions << QStringLiteral("inline-reply") << QLatin1String("");
+    }
+    argumentList << actions; // actions
+    argumentList << hints;   // hints
+    argumentList << (int)-1; // timeout in ms
 
     QDBusPendingCall call = dbus.asyncCallWithArgumentList(QStringLiteral("Notify"), argumentList);
     auto watcher          = new QDBusPendingCallWatcher{call, this};