Commit f4e951e9 by Sam Padgett Committed by GitHub

Merge pull request #174 from benjaminapetersen/bpeterse/notification-id

Improve notification id
parents 9843de79 637141a4
...@@ -2149,7 +2149,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function() ...@@ -2149,7 +2149,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
}; };
var addNotification = function (notification) { var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-'); notification.id = notification.id || _.uniqueId('notification-') + Date.now();
notification.timestamp = new Date().toISOString(); notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) { if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return; return;
......
...@@ -5720,7 +5720,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function() ...@@ -5720,7 +5720,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
}; };
var addNotification = function (notification) { var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-'); notification.id = notification.id || _.uniqueId('notification-') + Date.now();
notification.timestamp = new Date().toISOString(); notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) { if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return; return;
......
...@@ -2415,7 +2415,7 @@ this.dismissDelay = 8e3, this.autoDismissTypes = [ "info", "success" ], this.$ge ...@@ -2415,7 +2415,7 @@ this.dismissDelay = 8e3, this.autoDismissTypes = [ "info", "success" ], this.$ge
var notifications = [], dismissDelay = this.dismissDelay, autoDismissTypes = this.autoDismissTypes, notificationHiddenKey = function(notificationID, namespace) { var notifications = [], dismissDelay = this.dismissDelay, autoDismissTypes = this.autoDismissTypes, notificationHiddenKey = function(notificationID, namespace) {
return namespace ? "hide/notification/" + namespace + "/" + notificationID :"hide/notification/" + notificationID; return namespace ? "hide/notification/" + namespace + "/" + notificationID :"hide/notification/" + notificationID;
}, addNotification = function(notification) { }, addNotification = function(notification) {
notification.id = notification.id || _.uniqueId("notification-"), notification.timestamp = new Date().toISOString(), isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification) || (notifications.push(notification), $rootScope.$emit("NotificationsService.onNotificationAdded", notification)); notification.id = notification.id || _.uniqueId("notification-") + Date.now(), notification.timestamp = new Date().toISOString(), isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification) || (notifications.push(notification), $rootScope.$emit("NotificationsService.onNotificationAdded", notification));
}, hideNotification = function(notificationID) { }, hideNotification = function(notificationID) {
notificationID && _.each(notifications, function(notification) { notificationID && _.each(notifications, function(notification) {
notification.id === notificationID && (notification.hidden = !0); notification.id === notificationID && (notification.hidden = !0);
......
...@@ -18,7 +18,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function() ...@@ -18,7 +18,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
}; };
var addNotification = function (notification) { var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-'); notification.id = notification.id || _.uniqueId('notification-') + Date.now();
notification.timestamp = new Date().toISOString(); notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) { if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment