From db7691fe6d857b6bd69685db41d975792cb7bfeb Mon Sep 17 00:00:00 2001
From: ji_emme <jm81@hotmail.fr>
Date: Mon, 16 Apr 2018 23:31:00 +0200
Subject: [PATCH] #684 delete cesium profile

---
 www/plugins/es/i18n/locale-en-GB.json              |  2 +-
 www/plugins/es/i18n/locale-en.json                 |  2 +-
 .../es/js/controllers/wallet-controllers.js        |  2 +-
 www/plugins/es/js/services/profile-services.js     | 14 +++-----------
 4 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json
index d7949951..522069e7 100644
--- a/www/plugins/es/i18n/locale-en-GB.json
+++ b/www/plugins/es/i18n/locale-en-GB.json
@@ -318,7 +318,7 @@
       "DELETE": "Are you sure you want to <b>delete your cesium+ profile ?</b><br/><br/>This operation is irreversible."
     },
     "ERROR": {
-      "REMOVE_PROFILE_FAILED": "deleting profile failed",
+      "REMOVE_PROFILE_FAILED": "Deleting profile failed",
       "LOAD_PROFILE_FAILED": "Could not load user profile.",
       "SAVE_PROFILE_FAILED": "Saving profile failed",
       "INVALID_SOCIAL_NETWORK_FORMAT": "Invalid format: please fill a valid Internet address.<br/><br/>Examples :<ul><li>- A Facebook page (https://www.facebook.com/user)</li><li>- A web page (http://www.domain.com)</li><li>- An email address (joe@dalton.com)</li></ul>",
diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json
index d7949951..522069e7 100644
--- a/www/plugins/es/i18n/locale-en.json
+++ b/www/plugins/es/i18n/locale-en.json
@@ -318,7 +318,7 @@
       "DELETE": "Are you sure you want to <b>delete your cesium+ profile ?</b><br/><br/>This operation is irreversible."
     },
     "ERROR": {
-      "REMOVE_PROFILE_FAILED": "deleting profile failed",
+      "REMOVE_PROFILE_FAILED": "Deleting profile failed",
       "LOAD_PROFILE_FAILED": "Could not load user profile.",
       "SAVE_PROFILE_FAILED": "Saving profile failed",
       "INVALID_SOCIAL_NETWORK_FORMAT": "Invalid format: please fill a valid Internet address.<br/><br/>Examples :<ul><li>- A Facebook page (https://www.facebook.com/user)</li><li>- A web page (http://www.domain.com)</li><li>- An email address (joe@dalton.com)</li></ul>",
diff --git a/www/plugins/es/js/controllers/wallet-controllers.js b/www/plugins/es/js/controllers/wallet-controllers.js
index f7ab555f..e6f330b8 100644
--- a/www/plugins/es/js/controllers/wallet-controllers.js
+++ b/www/plugins/es/js/controllers/wallet-controllers.js
@@ -42,7 +42,7 @@ function ESWalletController($scope, $controller, esModals,csWallet,UIUtils,esPro
        UIUtils.alert.confirm('PROFILE.CONFIRM.DELETE')
          .then(function(confirm) {
               if (confirm){ 
-                  esProfile.delete(walletData.pubkey)
+                  esProfile.remove(walletData.pubkey)
                   .then(function () {
                     $scope.formData.name=null;
                     $scope.formData.profile = null;
diff --git a/www/plugins/es/js/services/profile-services.js b/www/plugins/es/js/services/profile-services.js
index 8d1fecc1..39ab95e8 100644
--- a/www/plugins/es/js/services/profile-services.js
+++ b/www/plugins/es/js/services/profile-services.js
@@ -1,4 +1,4 @@
-angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http.services', 'cesium.crypto.services'])
+angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http.services'])
   .config(function(PluginServiceProvider, csConfig) {
     'ngInject';
 
@@ -22,8 +22,7 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
       get: esHttp.get('/user/profile/:id?&_source_exclude=avatar._content'),
       getAll: esHttp.get('/user/profile/:id'),
       search: esHttp.post('/user/profile/_search'),
-      mixedSearch: esHttp.post('/user,page,group/profile,record/_search'),
-      delete: esHttp.post('/user/profile/_delete/:id')
+      mixedSearch: esHttp.post('/user,page,group/profile,record/_search')
     };
 
     function getAvatarAndName(pubkey) {
@@ -49,13 +48,6 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
         });
     }
 
-    function deleteProfile(pubkey) {
-      var id = pubkey;
-      return esHttp.record.remove("user","profile")(id).then(function(res) {
-          return res;
-      });
-    }
-
     function getProfile(pubkey, options) {
       options = options || {};
 
@@ -399,7 +391,7 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
       update: esHttp.record.post('/user/profile/:id/_update', {tagFields: ['title', 'description']}),
       avatar: esHttp.get('/user/profile/:id?_source=avatar'),
       fillAvatars: fillAvatars,
-      delete: deleteProfile
+      remove: esHttp.record.remove("user","profile")
     };
   })
 ;
-- 
GitLab