Skip to content

Commit

Permalink
fix: Don't modify cachedNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy authored and daniellandau committed Apr 2, 2024
1 parent 00e1fd8 commit ebb0e61
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/shell/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const Source = GObject.registerClass({
*/
_createNotification(notification) {
const [idMatch, deviceId, requestReplyId, remoteId, localId] = this._parseNotificationId(notification.id);
let cachedNotification = this._notifications[localId];
const cachedNotification = this._notifications[localId];

// Check if this is a repeat
if (cachedNotification) {
Expand All @@ -247,35 +247,35 @@ const Source = GObject.registerClass({

if (cachedNotification.title === title &&
cachedNotification.bannerBodyText === body)
return;
return cachedNotification;

cachedNotification.title = title;
cachedNotification.bannerBodyText = body;
cachedNotification.body = body;

// Device Notification
} else if (idMatch) {
cachedNotification = notification;
return cachedNotification;
}

cachedNotification.deviceId = deviceId;
cachedNotification.remoteId = remoteId;
cachedNotification.requestReplyId = requestReplyId;
// Device Notification
if (idMatch) {
notification.deviceId = deviceId;
notification.remoteId = remoteId;
notification.requestReplyId = requestReplyId;

cachedNotification.connect('destroy', (notification, reason) => {
notification.connect('destroy', (notification, reason) => {
this._closeGSConnectNotification(notification, reason);
delete this._notifications[localId];
});

this._notifications[localId] = cachedNotification;

// Service Notification
} else {
cachedNotification.connect('destroy', (notification, reason) => {
notification.connect('destroy', (notification, reason) => {
delete this._notifications[localId];
});
this._notifications[localId] = cachedNotification;
}
return cachedNotification;

this._notifications[localId] = notification;
return notification;
}

/*
Expand Down

0 comments on commit ebb0e61

Please sign in to comment.