From b172cc0b4502ce72777e56d19fe6668bb967b672 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Mon, 23 Jan 2017 17:33:12 +0100
Subject: [PATCH] - remove Market & Registry menu item - fix network peer
 filter, and default filter on currency view

---
 www/js/app.js                                 |  4 ++--
 www/js/controllers/currency-controllers.js    |  3 +--
 www/js/controllers/network-controllers.js     |  8 +++----
 www/js/services/network-services.js           |  4 ++--
 www/plugins/es/i18n/locale-en-GB.json         |  2 +-
 www/plugins/es/i18n/locale-en.json            |  2 +-
 www/plugins/es/i18n/locale-fr-FR.json         |  2 +-
 www/plugins/es/i18n/locale-nl-NL.json         |  2 +-
 .../es/js/controllers/settings-controllers.js |  2 +-
 www/plugins/es/templates/menu_extend.html     |  8 +++----
 www/templates/currency/items_network.html     |  2 +-
 www/templates/network/view_network.html       | 22 -------------------
 12 files changed, 19 insertions(+), 42 deletions(-)
 delete mode 100644 www/templates/network/view_network.html

diff --git a/www/js/app.js b/www/js/app.js
index 5f7350ede..4ef4ee710 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -29,8 +29,8 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht
 
     function formatRelative(input, options) {
       var currentUD = options && options.currentUD ? options.currentUD : csWallet.data.currentUD;
-      if (!currentUD) {
-        console.warn("formatAmount: currentUD not defined, and user not logged in");
+      if (!amount || !currentUD) {
+        console.warn("formatAmount: amount or currentUD not defined");
         return;
       }
       var amount = input / currentUD;
diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js
index 4c0ac42ff..d9b0de872 100644
--- a/www/js/controllers/currency-controllers.js
+++ b/www/js/controllers/currency-controllers.js
@@ -100,8 +100,7 @@ function CurrencyLookupController($scope, $state, UIUtils, csCurrency) {
   };
 }
 
-function CurrencyViewController($scope, $q, $translate, $timeout, $filter,
-  BMA, UIUtils, csSettings, csCurrency, csNetwork) {
+function CurrencyViewController($scope, $q, BMA, UIUtils, csSettings, csCurrency) {
   $scope.formData = {
     useRelative: csSettings.data.useRelative
   };
diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js
index c25b2c1ab..4066d69c8 100644
--- a/www/js/controllers/network-controllers.js
+++ b/www/js/controllers/network-controllers.js
@@ -6,7 +6,7 @@ angular.module('cesium.network.controllers', ['cesium.services'])
 
   $stateProvider
 
-     .state('app.view_peer', {
+    .state('app.view_peer', {
       url: "/network/peer/:server",
       nativeTransitions: {
           "type": "flip",
@@ -36,7 +36,7 @@ function NetworkLookupController($scope, $timeout, $state, $ionicPopover, BMA, U
   $scope.search = {
     text: '',
     loading: true,
-    type: 'member',
+    type: undefined,
     results: []
   };
 
@@ -65,8 +65,8 @@ function NetworkLookupController($scope, $timeout, $state, $ionicPopover, BMA, U
     if ($scope.search.loading){
       csNetwork.start($scope.node, {
         filter: {
-          member: ($scope.search.type === 'member'),
-          mirror: ($scope.search.type === 'mirror')
+          member: (!$scope.search.type || $scope.search.type === 'member'),
+          mirror: (!$scope.search.type || $scope.search.type === 'mirror')
         }
       });
 
diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js
index 27fc3df86..ca1f704e7 100644
--- a/www/js/services/network-services.js
+++ b/www/js/services/network-services.js
@@ -120,8 +120,8 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se
         if (!data.filter) return true;
 
         // Filter member and mirror
-        if ((data.filter.member && !peer.uid) ||
-            (data.filter.mirror && peer.uid)) {
+        if ((data.filter.member && !data.filter.mirror && !peer.uid) ||
+            (data.filter.mirror && !data.filter.member && peer.uid)) {
           return false;
         }
 
diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json
index 1b68c41a0..f16c0015e 100644
--- a/www/plugins/es/i18n/locale-en-GB.json
+++ b/www/plugins/es/i18n/locale-en-GB.json
@@ -268,7 +268,7 @@
     }
   },
   "ES_SETTINGS": {
-    "PLUGIN_NAME": "Registry and market place",
+    "PLUGIN_NAME": "Cesium+: user profiles, notifications, private messages...",
     "ENABLE_TOGGLE": "Enable extension?",
     "ENABLE_MARKET_TOGGLE": "Enable market place?",
     "ENABLE_REGISTRY_TOGGLE": "Enable companies registry?",
diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json
index 1b68c41a0..f16c0015e 100644
--- a/www/plugins/es/i18n/locale-en.json
+++ b/www/plugins/es/i18n/locale-en.json
@@ -268,7 +268,7 @@
     }
   },
   "ES_SETTINGS": {
-    "PLUGIN_NAME": "Registry and market place",
+    "PLUGIN_NAME": "Cesium+: user profiles, notifications, private messages...",
     "ENABLE_TOGGLE": "Enable extension?",
     "ENABLE_MARKET_TOGGLE": "Enable market place?",
     "ENABLE_REGISTRY_TOGGLE": "Enable companies registry?",
diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json
index 23b72e00f..7f4d9a72b 100644
--- a/www/plugins/es/i18n/locale-fr-FR.json
+++ b/www/plugins/es/i18n/locale-fr-FR.json
@@ -268,7 +268,7 @@
     }
   },
   "ES_SETTINGS": {
-    "PLUGIN_NAME": "Annonces, professionnels et messages privés",
+    "PLUGIN_NAME": "Cesium+ : profils et avatar, notifications, messages privés...",
     "ENABLE_TOGGLE": "Activer l'extension ?",
     "ENABLE_MARKET_TOGGLE": "Activer les annonces ?",
     "ENABLE_REGISTRY_TOGGLE": "Activer l'annuaire des pro ?",
diff --git a/www/plugins/es/i18n/locale-nl-NL.json b/www/plugins/es/i18n/locale-nl-NL.json
index f8b7f6c8b..9f76ae871 100644
--- a/www/plugins/es/i18n/locale-nl-NL.json
+++ b/www/plugins/es/i18n/locale-nl-NL.json
@@ -268,7 +268,7 @@
     }
   },
   "ES_SETTINGS": {
-    "PLUGIN_NAME": "Register en marktplaats",
+    "PLUGIN_NAME": "Cesium+",
     "ENABLE_TOGGLE": "Uitbreiding inschakelen?",
     "ENABLE_MARKET_TOGGLE": "Marktplaats inschakelen?",
     "ENABLE_REGISTRY_TOGGLE": "Bedrijfsregister inschakelen?",
diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js
index 28ac79e73..b50885a5e 100644
--- a/www/plugins/es/js/controllers/settings-controllers.js
+++ b/www/plugins/es/js/controllers/settings-controllers.js
@@ -137,7 +137,7 @@ function ESPluginSettingsController ($scope, $q,  $translate, $ionicPopup, UIUti
             var parts = node.split(':');
             resolve({
               host: parts[0],
-              port: parts[1]
+              port: parts[1] || 80
             });
           });
         });
diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html
index a11d570f9..3b20b2471 100644
--- a/www/plugins/es/templates/menu_extend.html
+++ b/www/plugins/es/templates/menu_extend.html
@@ -29,23 +29,23 @@
 <!-- Main section -->
 <ng-if ng-if="enable && extensionPoint === 'menu-main'">
 
-  <!-- registry-->
+  <!-- registry
   <ion-item menu-close class="item item-icon-left"
             active-link="active"
             active-link-path-prefix="#/app/registry"
             href="#/app/registry">
     <i class="icon ion-ios-book"></i>
     <span translate>MENU.REGISTRY</span>
-  </ion-item>
+  </ion-item>-->
 
-  <!-- market -->
+  <!-- market
   <ion-item menu-close class="item item-icon-left"
             active-link="active"
             active-link-path-prefix="#/app/market"
             href="#/app/market">
     <i class="icon ion-speakerphone"></i>
     <span translate>MENU.MARKET</span>
-  </ion-item>
+  </ion-item>-->
 </ng-if>
 
 <!-- User section -->
diff --git a/www/templates/currency/items_network.html b/www/templates/currency/items_network.html
index 52a336637..eea8739eb 100644
--- a/www/templates/currency/items_network.html
+++ b/www/templates/currency/items_network.html
@@ -17,7 +17,7 @@
     <span class="badge badge-stable">{{difficulty | formatInteger}}</span>
   </ion-item>
 
-  <ng-controller ng-controller="NetworkLookupCtrl" ng-init="search.type='member';">
+  <ng-controller ng-controller="NetworkLookupCtrl">
 
     <div id="helptip-currency-peers"
          class="item item-divider">
diff --git a/www/templates/network/view_network.html b/www/templates/network/view_network.html
deleted file mode 100644
index a2251c74b..000000000
--- a/www/templates/network/view_network.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<ion-view
-    left-buttons="leftButtons" class="pane"
-    cache-view="false"
-    >
-  <ion-nav-title>
-  </ion-nav-title>
-
-    <ion-nav-buttons side="secondary">
-        <button class="button button-icon button-clear icon ion-loop visible-xs visible-sm" ng-click="refresh()">
-        </button>
-    </ion-nav-buttons>
-
-    <ion-content>
-      <div class="row">
-        <div class="row responsive-sm">
-            <div class="col col-100">
-              <ng-include src="'templates/network/tabs/view_nodes.html'"></ng-include>
-            </div>
-        </div>
-    </ion-content>
-
-</ion-view>
-- 
GitLab