From dc4a9f5a99158f9491f83eb2fca813e1cdff3220 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Fri, 19 May 2017 19:06:55 +0200
Subject: [PATCH] make sure ntofication.id is always set, before wending read
 notification

---
 www/plugins/es/js/services/notification-services.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/www/plugins/es/js/services/notification-services.js b/www/plugins/es/js/services/notification-services.js
index 8927b255b..b49c94980 100644
--- a/www/plugins/es/js/services/notification-services.js
+++ b/www/plugins/es/js/services/notification-services.js
@@ -169,7 +169,12 @@ angular.module('cesium.es.notification.services', ['cesium.services', 'cesium.es
 
   // Mark a notification as read
   function markNotificationAsRead(notification) {
-    if (notification.read) return; // avoid multi call
+    if (notification.read || !notification.id) return; // avoid multi call
+    // Should never append (fix in Duniter4j issue #12)
+    if (!notification.id) {
+      console.error('[ES] [notification] Could not mark as read: no \'id\' found!', notification);
+      return;
+    }
     notification.read = true;
     CryptoUtils.sign(notification.hash, csWallet.data.keypair)
       .then(function(signature){
-- 
GitLab