diff --git a/www/plugins/es/js/entities/notification.js b/www/plugins/es/js/entities/notification.js index eee62d735428ae7f91a93e26a0e46aaec6cd9ff9..942764b56fb4888cce6f2785b8d1a2a8e2cb680a 100644 --- a/www/plugins/es/js/entities/notification.js +++ b/www/plugins/es/js/entities/notification.js @@ -11,14 +11,15 @@ function EsNotification(json, markAsReadCallback) { // Avoid undefined errors json = json || {}; + that.id = json.id || ('' + Date.now()); // Keep id if exists, otherwise create it from timestamp that.type = json.type && json.type.toLowerCase(); that.time = json.time; that.hash = json.hash; that.read = json.read_signature ? true : false; - that.message = json.reference && messagePrefixes[json.reference.index] ? + that.message = json.code && (json.reference && messagePrefixes[json.reference.index] ? messagePrefixes[json.reference.index] + json.code : - 'EVENT.' + json.code; + 'EVENT.' + json.code) ||Â json.message; that.params = json.params; if (markAsReadCallback && (typeof markAsReadCallback === "function") ) { diff --git a/www/plugins/es/js/services/notification-services.js b/www/plugins/es/js/services/notification-services.js index 630c0dcf29372b2c16a6c8930f04afa02bf839a2..3591a6fb6242273763921b1e921f58d92b0020c7 100644 --- a/www/plugins/es/js/services/notification-services.js +++ b/www/plugins/es/js/services/notification-services.js @@ -118,7 +118,7 @@ angular.module('cesium.es.notification.services', ['cesium.platform', 'cesium.es // Add some wallet events as notifications var time = csHttp.date.now() - filterTranslations.MEDIAN_TIME_OFFSET; var result = (wallet.data.events || []).reduce(function(res, event) { - if (event.type != "warn" && event.type != "error") return res; // Keep only warn and error events + if (event.type !== "warn" && event.type !== "error") return res; // Keep only warn and error events var notification = new EsNotification({}, function(self) { if (!self.read) { self.read = true; @@ -127,12 +127,12 @@ angular.module('cesium.es.notification.services', ['cesium.platform', 'cesium.es } } }); - notification.id=event.code; + notification.id= event.code; + notification.time= time; notification.read = false; notification.state = 'app.view_wallet'; notification.avatarIcon = 'ion-alert-circled'; notification.icon = 'ion-alert-circled assertive'; - notification.time = time; notification.message = event.message; notification.messageParams = event.messageParams; return res.concat(notification); @@ -200,6 +200,7 @@ angular.module('cesium.es.notification.services', ['cesium.platform', 'cesium.es } var notification = new EsNotification(event, markNotificationAsRead); + notification.id = event.id ||Â notification.id; // Extend the notification entity return csWot.extendAll([notification])