Skip to content

Commit 54a11e8

Browse files
authored
Merge pull request #5530 from nextcloud/feature/obeyShouldNotifyFlag
follow shouldNotify flag to hide notifications when needed
2 parents 5e505d9 + e0bdbd1 commit 54a11e8

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/gui/tray/activitydata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class Activity
157157
* @return
158158
*/
159159

160+
bool _shouldNotify = true;
160161

161162
[[nodiscard]] Identifier ident() const;
162163
};

src/gui/tray/notificationhandler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
105105
}
106106
}
107107

108+
if (json.contains("shouldNotify")) {
109+
a._shouldNotify = json.value("shouldNotify").toBool(true);
110+
}
111+
108112
// 2 cases to consider:
109113
// 1. server == 24 & has Talk: object_type is chat/call/room & object_id contains conversationToken/messageId
110114
// 2. server < 24 & has Talk: object_type is chat/call/room & object_id contains _only_ conversationToken

src/gui/tray/usermodel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)
193193
qCInfo(lcActivity) << "Activity already notified, skip";
194194
return false;
195195
}
196+
if (!activity._shouldNotify) {
197+
qCDebug(lcActivity) << "Activity should not be notified";
198+
return false;
199+
}
196200

197201
return true;
198202
});
@@ -226,6 +230,11 @@ void User::slotBuildIncomingCallDialogs(const ActivityList &list)
226230

227231
if(systray) {
228232
for(const auto &activity : list) {
233+
if (!activity._shouldNotify) {
234+
qCDebug(lcActivity) << "Activity should not be notified";
235+
continue;
236+
}
237+
229238
systray->createCallDialog(activity, _account);
230239
}
231240
}

0 commit comments

Comments
 (0)