Skip to content

Commit 0a59c4d

Browse files
ferdnycandyholmes
authored andcommitted
Don't re-show repeated notifications
GSConnect receives a lot of duplicate notifications, whether due to reconnects, proactively requesting updates, etc. Since GNOME 46, each of those repeats has been popped up as a new banner notification every time it's received, even if nothing has changed in the notification content. This is extremely disruptive. To avoid that, don't blindly flag all repeated notifications as "unacknowledged", which will cause them to be popped up again. Only do so if the content has changed. (This covers re-displaying banners for SMS conversations that receive an additional message, since those are sent as updates to the existing notification.) Fixes #1855
1 parent fb1b308 commit 0a59c4d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/shell/notification.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,20 @@ const Source = GObject.registerClass({
239239
if (cachedNotification) {
240240
cachedNotification.requestReplyId = requestReplyId;
241241

242-
// Bail early If @notificationParams represents an exact repeat
243242
const title = notification.title;
244243
const body = notification.body
245244
? notification.body
246245
: null;
247246

247+
// Bail early If @notification represents an exact repeat
248248
if (cachedNotification.title === title &&
249249
cachedNotification.body === body)
250250
return cachedNotification;
251251

252+
// If the details have changed, flag as an update
252253
cachedNotification.title = title;
253254
cachedNotification.body = body;
254-
255+
cachedNotification.acknowledged = false;
255256
return cachedNotification;
256257
}
257258

@@ -304,10 +305,8 @@ const Source = GObject.registerClass({
304305
* notification limit (3)
305306
*/
306307
_addNotificationToMessageTray(notification) {
307-
if (this.notifications.includes(notification)) {
308-
notification.acknowledged = false;
308+
if (this.notifications.includes(notification))
309309
return;
310-
}
311310

312311
while (this.notifications.length >= 10) {
313312
const [oldest] = this.notifications;

0 commit comments

Comments
 (0)