Skip to content

Commit a47d4b2

Browse files
committed
fix notification removed when not found
When a notification is closed, prior to timouting, from $rootScope (e.g. from handleClose), then the timeout closes the wrong notification. This is because notification is by the timeouting removed completely from list and the `.indexOf` returns `-1`, which removes last notification.
1 parent 4199b06 commit a47d4b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/notification/notification.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ angular.module('patternfly.notification').provider('Notifications', function ()
181181
};
182182

183183
notifications.remove = function (notification) {
184-
notifications.removeIndex($rootScope.notifications.data.indexOf(notification));
184+
var index = $rootScope.notifications.data.indexOf(notification);
185+
if (index !== -1) {
186+
notifications.removeIndex(index);
187+
}
185188
};
186189

187190
notifications.removeIndex = function (index) {

0 commit comments

Comments
 (0)