From d29501bd655326af52017e3f3b0c3b28d156b2b7 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Wed, 13 Mar 2019 11:11:46 +0100
Subject: [PATCH] [fix] Display warning on out distance only if enough
 certification - fix #808

---
 www/js/services/wallet-services.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js
index 31f5d3b5d..c32a81ca0 100644
--- a/www/js/services/wallet-services.js
+++ b/www/js/services/wallet-services.js
@@ -726,9 +726,10 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se
         });
     },
 
-    // Generate events from requirements
+    /**
+     * Add user events (generate events from requirements)
+     */
     addEvents = function() {
-      // Add user events
       if (data.requirements.revoked) {
         delete data.requirements.meta.invalid;
         addEvent({type:'info', message: 'ERROR.WALLET_REVOKED', context: 'requirements'});
@@ -737,6 +738,8 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se
         delete data.requirements.meta.invalid;
         addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'});
       }
+
+      // If not revoked
       else {
         if (!data.isMember && data.requirements.meta.invalid) {
           addEvent({type: 'error', message: 'ERROR.WALLET_INVALID_BLOCK_HASH', context: 'requirements'});
@@ -747,11 +750,13 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se
           addEvent({type: 'error', message: 'ERROR.WALLET_IDENTITY_EXPIRED', context: 'requirements'});
           console.debug("Identity expired for uid={0}.".format(data.uid));
         }
+        // Pending membership
         else if (data.requirements.pendingMembership) {
           addEvent({type:'pending', message: 'ACCOUNT.WAITING_MEMBERSHIP', context: 'requirements'});
 
-          // Add a warning when out distanced - fix #777
-          if (data.requirements.outdistanced) {
+          // Add a warning when out distanced
+          // (only if has enough certification - fix #808)
+          if (!data.requirements.needCertificationCount && data.requirements.outdistanced) {
             addEvent({type:'warn', message: 'ACCOUNT.OUT_DISTANCED', context: 'requirements'});
           }
         }
-- 
GitLab