From d59c822b444d36ea2ee6d4a03fa3accf93dd9104 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Thu, 23 Apr 2020 12:26:54 +0200
Subject: [PATCH] [fix] Unable to like a profile or page (always open the
 report abuse)

---
 www/plugins/es/js/controllers/like-controllers.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/www/plugins/es/js/controllers/like-controllers.js b/www/plugins/es/js/controllers/like-controllers.js
index 2982ce9f..eca68ff8 100644
--- a/www/plugins/es/js/controllers/like-controllers.js
+++ b/www/plugins/es/js/controllers/like-controllers.js
@@ -115,9 +115,11 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil
     // Make sure tobe auth before continue
     if (!csWallet.isLogin()) {
       return csWallet.auth({minData: true})
-        .then(function(){
+        .then(function(data){
           UIUtils.loading.hide();
-          return $scope.reportAbuse(event, options); // loop
+          if (!data) throw new Error('CANCELLED');
+          options.pubkey = options.pubkey || data.pubkey;
+          return $scope.toggleLike(event, options); // loop
         });
     }
 
@@ -141,9 +143,9 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil
       else {
         return Modals.showSelectWallet({displayBalance: false})
           .then(function (wallet) {
-            if (!wallet) throw 'CANCELLED';
+            if (!wallet) throw new Error('CANCELLED');
             options.pubkey = wallet.data.pubkey;
-            return $scope.reportAbuse(event, options); // Loop
+            return $scope.toggleLike(event, options); // Loop
           });
       }
     }
@@ -243,8 +245,10 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil
     // Make sure tobe auth before continue
     if (!csWallet.isLogin()) {
       return csWallet.auth({minData: true})
-        .then(function(){
+        .then(function(data){
           UIUtils.loading.hide();
+          if (!data) throw new Error('CANCELLED');
+          options.pubkey = options.pubkey || data.pubkey;
           return $scope.reportAbuse(event, options); // loop
         });
     }
-- 
GitLab