Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't re-show repeated notifications #1860

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/shell/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,20 @@ const Source = GObject.registerClass({
if (cachedNotification) {
cachedNotification.requestReplyId = requestReplyId;

// Bail early If @notificationParams represents an exact repeat
const title = notification.title;
const body = notification.body
? notification.body
: null;

// Bail early If @notification represents an exact repeat
if (cachedNotification.title === title &&
cachedNotification.body === body)
return cachedNotification;

// If the details have changed, flag as an update
cachedNotification.title = title;
cachedNotification.body = body;

cachedNotification.acknowledged = false;
return cachedNotification;
}

Expand Down Expand Up @@ -304,10 +305,8 @@ const Source = GObject.registerClass({
* notification limit (3)
*/
_addNotificationToMessageTray(notification) {
if (this.notifications.includes(notification)) {
notification.acknowledged = false;
if (this.notifications.includes(notification))
return;
}

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