From 36630700f02c42200d659f92423ccd369357d077 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Wed, 17 May 2017 16:11:23 +0200
Subject: [PATCH] [fix] avoid duplicated message on not filled profile #439

---
 www/js/services/wallet-services.js          | 3 ++-
 www/plugins/es/js/services/user-services.js | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js
index 18ca4cc45..4d289cdd6 100644
--- a/www/js/services/wallet-services.js
+++ b/www/js/services/wallet-services.js
@@ -1772,7 +1772,8 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser
         out: membership(false)
       },
       events: {
-        add: addEvent
+        add: addEvent,
+        cleanByContext: cleanEventsByContext
       },
       certify: certify,
       store: store,
diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js
index 1e511247f..cb1c51e49 100644
--- a/www/plugins/es/js/services/user-services.js
+++ b/www/plugins/es/js/services/user-services.js
@@ -141,9 +141,13 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
 
   function onWalletFinishLoad(data, deferred) {
     deferred = deferred || $q.defer();
+
+    // Reset events
+    csWallet.events.cleanByContext('cesium+');
+
     // If membership pending, but not enough certifications: suggest to fill user profile
     if (!data.name && data.requirements.pendingMembership && data.requirements.needCertificationCount > 0) {
-      data.events.push({type:'info',message: 'ACCOUNT.EVENT.MEMBER_WITHOUT_PROFILE'});
+      csWallet.events.add({type:'info', message: 'ACCOUNT.EVENT.MEMBER_WITHOUT_PROFILE', context: 'cesium+'});
     }
 
     console.debug('[ES] [user] Loading full user profile...');
-- 
GitLab