sanitize wallet list

This commit is contained in:
Matias Alejo Garcia 2015-11-18 16:37:15 -03:00
commit 2e7cd8770c
2 changed files with 7 additions and 4 deletions

View file

@ -792,7 +792,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (!txs || !txs[0]) return;
var cacheUnit = txs[0].amountStr.split(' ')[1];
console.log('[index.js.794:cacheUnit:]', cacheUnit, config.unitName); //TODO
if (cacheUnit == config.unitName)
return;

View file

@ -28,8 +28,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.switchWallet = function(selectedWalletId, currentWalletId) {
if (selectedWalletId == currentWalletId) return;
self.walletSelection = false;
profileService.setAndStoreFocus(selectedWalletId, function() {
});
profileService.setAndStoreFocus(selectedWalletId, function() {});
};
self.toggleWalletSelection = function() {
@ -40,10 +39,14 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.setWallets = function() {
if (!profileService.profile) return;
var config = configService.getSync();
config.colorFor = config.colorFor || {};
config.aliasFor = config.aliasFor || {};
var ret = lodash.map(profileService.profile.credentials, function(c) {
// Sanitize empty wallets (fixed in BWC 1.8.1, and auto fixed when wallets completes)
var credentials = lodash.filter(profileService.profile.credentials, 'walletName');
var ret = lodash.map(credentials, function(c) {
return {
m: c.m,
n: c.n,
@ -52,6 +55,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
color: config.colorFor[c.walletId] || '#4A90E2',
};
});
self.wallets = lodash.sortBy(ret, 'name');
};