From 6bacd64747a44d1b58251c8861a8a5a2fec8df6c Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Fri, 28 Oct 2016 22:14:10 +0200
Subject: [PATCH] Fix uid fill in

---
 www/plugins/es/js/services/user-services.js   | 21 +++++++------------
 .../es/templates/common/view_comments.html    |  2 +-
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js
index 5f6bf2249..1023dd85e 100644
--- a/www/plugins/es/js/services/user-services.js
+++ b/www/plugins/es/js/services/user-services.js
@@ -71,7 +71,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
     }
 
     function onWalletReset(data) {
-      //data.avatar = null;
+      data.avatar = null;
       data.avatarStyle = null;
       data.profile = null;
       data.name = null;
@@ -92,7 +92,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
           data.profile = res._source;
           if (avatar) {
             data.avatarStyle={'background-image':'url("'+avatar.src+'")'};
-            //data.avatar=avatar;
+            data.avatar=avatar;
             delete res._source.avatar;
           }
           data.profile = res._source;
@@ -171,12 +171,15 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
         return;
       }
 
-      var uidsByPubkey;
       var hits;
       $q.all([
         BMA.wot.member.uids()
-          .then(function(res){
-            uidsByPubkey = res;
+          .then(function(uidsByPubkey){
+            _.forEach(datas, function(data) {
+              if (!data.uid && data[pubkeyAtributeName]) {
+                data.uid = uidsByPubkey[data[pubkeyAtributeName]];
+              }
+            });
           }),
         esHttp.post(host, port, '/user/profile/_search')(request)
           .then(function(res){
@@ -184,11 +187,6 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
           })
       ])
       .then(function() {
-        _.forEach(datas, function(data) {
-          if (!data.uid && data[pubkeyAtributeName]) {
-            data.uid = uidsByPubkey[data[pubkeyAtributeName]];
-          }
-        });
         if (hits.total === 0) {
           resolve(datas);
         }
@@ -208,9 +206,6 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se
                 data.avatar=avatar;
               }
               data.name=hit._source.title;
-              if (!data.uid && hit._source.uid) {
-                data.uid = hit._source.uid;
-              }
               if (hit.highlight) {
                 if (hit.highlight.title) {
                     data.name = hit.highlight.title[0];
diff --git a/www/plugins/es/templates/common/view_comments.html b/www/plugins/es/templates/common/view_comments.html
index 443e27881..3719bb0e7 100644
--- a/www/plugins/es/templates/common/view_comments.html
+++ b/www/plugins/es/templates/common/view_comments.html
@@ -37,7 +37,7 @@
       <span class="avatar"
             ng-style="comment.avatarStyle"
             ng-class="{'avatar-member': !comment.avatarStyle && comment.uid, 'avatar-wallet': !comment.avatarStyle && !comment.uid}"></span>
-      {{::comment.message}}
+      <span ng-bind-html="comment.message"></span>
       <div class="card-footer text-right gray">
         <a class="pull-right" ng-click="shareComment($event, $index)">
           &nbsp;<b class="icon ion-android-share-alt"></b>&nbsp;
-- 
GitLab