From bd10e445867c8fa9e5b3a98dfb292242b8a36a43 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Tue, 2 May 2017 11:40:47 +0200
Subject: [PATCH] [fix] update for Duniter4j v0.10.3 [fix] fix new message
 notification (pubkey was hidden when issuer was not a member)

---
 app/config.json                                  |  1 +
 www/js/controllers/wot-controllers.js            |  5 ++++-
 .../es/js/controllers/blockchain-controllers.js  |  2 --
 .../js/controllers/notification-controllers.js   | 16 ++++++++++------
 .../es/js/services/blockchain-services.js        |  2 +-
 www/plugins/es/js/services/message-services.js   |  7 ++++++-
 www/plugins/graph/js/services/data-services.js   |  6 +++---
 7 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/app/config.json b/app/config.json
index 345d84ccf..751d25089 100644
--- a/app/config.json
+++ b/app/config.json
@@ -85,6 +85,7 @@
     "useLocalStorage": true,
     "useRelative": true,
     "expertMode": true,
+    "decimalCount": 2,
     "helptip": {
       "enable": false,
       "installDocUrl": {
diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js
index 5d45c0e32..e33c53068 100644
--- a/www/js/controllers/wot-controllers.js
+++ b/www/js/controllers/wot-controllers.js
@@ -778,10 +778,13 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
       });
   };
 
-  $scope.doAction = function(action) {
+  $scope.doAction = function(action, options) {
     if (action == 'certify') {
       return $scope.certify();
     }
+    if (action == 'transfer') {
+      $scope.showTransferModal(options);
+    }
   };
 
   /* -- open screens -- */
diff --git a/www/plugins/es/js/controllers/blockchain-controllers.js b/www/plugins/es/js/controllers/blockchain-controllers.js
index 72180130b..c374275e4 100644
--- a/www/plugins/es/js/controllers/blockchain-controllers.js
+++ b/www/plugins/es/js/controllers/blockchain-controllers.js
@@ -106,7 +106,6 @@ function ESBlockLookupController($scope, $state, $controller, $ionicPopover, UIU
           "number": "desc"
         };
       }
-      request.excludeCurrent = true;
       promise = esBlockchain.block.search($scope.currency, request);
     }
 
@@ -122,7 +121,6 @@ function ESBlockLookupController($scope, $state, $controller, $ionicPopover, UIU
       else { // default sort
         request.sort = "number:desc";
       }
-      request.excludeCurrent = false;
       promise = esBlockchain.block.searchText($scope.currency, $scope.search.text, request);
     }
 
diff --git a/www/plugins/es/js/controllers/notification-controllers.js b/www/plugins/es/js/controllers/notification-controllers.js
index 9232ea31d..fbfd05bdb 100644
--- a/www/plugins/es/js/controllers/notification-controllers.js
+++ b/www/plugins/es/js/controllers/notification-controllers.js
@@ -45,12 +45,16 @@ function NotificationsController($scope, $rootScope, $ionicPopover, $state, $tim
 
   $scope.$on('$ionicView.enter', function() {
     if ($scope.search.loading) {
-      $scope.load();
-
-      // Reset unread counter
-      $timeout(function() {
-        $scope.resetUnreadCount();
-      }, 1000);
+      $scope.loadWallet({minData: true})
+        .then(function() {
+          $scope.load();
+          UIUtils.loading.hide();
+
+          // Reset unread counter
+          return $timeout(function() {
+            $scope.resetUnreadCount();
+          }, 1000);
+        });
     }
   });
 
diff --git a/www/plugins/es/js/services/blockchain-services.js b/www/plugins/es/js/services/blockchain-services.js
index 5958c4ce7..2c940df13 100644
--- a/www/plugins/es/js/services/blockchain-services.js
+++ b/www/plugins/es/js/services/blockchain-services.js
@@ -47,7 +47,7 @@ angular.module('cesium.es.blockchain.services', ['cesium.services', 'cesium.es.h
 
     exports.raw.block.processSearchResult = function(res, options) {
       options = options || {};
-      options.excludeCurrent = angular.isDefined(options.excludeCurrent) ? options.excludeCurrent : false;
+      options.excludeCurrent = angular.isDefined(options.excludeCurrent) ? options.excludeCurrent : true;
       options.fillAvatar = angular.isDefined(options.fillAvatar) ? options.fillAvatar : true;
       options.cleanData = angular.isDefined(options.cleanData) ? options.cleanData : true;
 
diff --git a/www/plugins/es/js/services/message-services.js b/www/plugins/es/js/services/message-services.js
index af1e0dcb0..eb9fb301d 100644
--- a/www/plugins/es/js/services/message-services.js
+++ b/www/plugins/es/js/services/message-services.js
@@ -94,11 +94,16 @@ angular.module('cesium.es.message.services', ['ngResource', 'cesium.services', '
     console.debug("[ES] [message] detected new message (from notification service)");
 
     var notification = new Notification(event);
+    notification.issuer = notification.pubkey;
+    delete notification.pubkey;
 
-    csWot.extendAll([notification])
+    csWot.extend(notification, 'issuer')
       .then(function() {
+
+
         csWallet.data.messages = csWallet.data.messages || {};
         csWallet.data.messages.unreadCount++;
+
         // Raise event
         api.data.raise.new(notification);
       });
diff --git a/www/plugins/graph/js/services/data-services.js b/www/plugins/graph/js/services/data-services.js
index eb96bc3b8..79711c2c9 100644
--- a/www/plugins/graph/js/services/data-services.js
+++ b/www/plugins/graph/js/services/data-services.js
@@ -15,8 +15,8 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es.
           block: {
             search: esHttp.post('/:currency/block/_search')
           },
-          blockStat: {
-            search: esHttp.post('/:currency/blockStat/_search?pretty')
+          blockstat: {
+            search: esHttp.post('/:currency/blockstat/_search?pretty')
           }
         },
         regex: {
@@ -302,7 +302,7 @@ angular.module('cesium.graph.data.services', ['cesium.wot.services', 'cesium.es.
           if (jobs.length < 10) {
 
             jobs.push(
-              exports.raw.blockStat.search(request, {currency: currency})
+              exports.raw.blockstat.search(request, {currency: currency})
                 .then(function (res) {
                   var aggs = res.aggregations;
                   if (!aggs.tx || !aggs.tx.buckets || !aggs.tx.buckets.length) return;
-- 
GitLab