mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
remove snap notifications when uninstalled (#17487)
This commit is contained in:
parent
245c32a99e
commit
82f2ba15e6
@ -1563,6 +1563,22 @@ export default class MetamaskController extends EventEmitter {
|
||||
},
|
||||
);
|
||||
|
||||
this.controllerMessenger.subscribe(
|
||||
`${this.snapController.name}:snapRemoved`,
|
||||
(truncatedSnap) => {
|
||||
const notificationIds = Object.values(
|
||||
this.notificationController.state.notifications,
|
||||
).reduce((idList, notification) => {
|
||||
if (notification.origin === truncatedSnap.id) {
|
||||
idList.push(notification.id);
|
||||
}
|
||||
return idList;
|
||||
}, []);
|
||||
|
||||
this.dismissNotifications(notificationIds);
|
||||
},
|
||||
);
|
||||
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user