From f47d7f158cfa1b1940fdbde368be15625c862a1c Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Fri, 10 Feb 2017 08:58:22 +0100
Subject: [PATCH] New certification sent not display - fix #320

---
 www/js/controllers/wot-controllers.js | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js
index b4de1ec51..fab9b1030 100644
--- a/www/js/controllers/wot-controllers.js
+++ b/www/js/controllers/wot-controllers.js
@@ -525,12 +525,11 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $timeout, UIU
               .then(function(cert) {
                 UIUtils.loading.hide();
                 if (cert) {
-                  cert.uid = csWallet.data.uid;
-                  cert.pubkey = csWallet.data.pubkey;
-                  cert.isMember = csWallet.data.isMember;
+                  $scope.prepareNewCert(cert);
+                  $scope.alreadyCertified = true;
                   UIUtils.alert.info('INFO.CERTIFICATION_DONE');
                   $scope.formData.received_cert_pending.unshift(cert);
-                  $scope.motionCertifications();
+                  $scope.doMotion();
                 }
               })
               .catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED'));
@@ -621,9 +620,10 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $timeout, UIU
               .then(function(cert) {
                 UIUtils.loading.hide();
                 if (cert) {
+                  $scope.prepareNewCert(cert);
                   UIUtils.alert.info('INFO.CERTIFICATION_DONE');
                   $scope.formData.given_cert_pending.unshift(cert);
-                  $scope.motionGivenCertifications();
+                  $scope.doMotion();
                 }
               })
               .catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED'));
@@ -633,6 +633,16 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $timeout, UIU
 
   };
 
+  // Add wallet's data to a new cert
+  $scope.prepareNewCert = function(cert) {
+    cert.uid = csWallet.data.uid;
+    cert.pubkey = csWallet.data.pubkey;
+    cert.isMember = csWallet.data.isMember;
+    cert.avatar = csWallet.data.avatar;
+    cert.name = csWallet.data.name;
+  };
+
+  // Could be override by subclass
   $scope.doMotion = function() {
     $timeout(function() {
       UIUtils.motion.fadeSlideInRight();
-- 
GitLab