diff --git a/src/js/controllers/app.controller.js b/src/js/controllers/app.controller.js index 8f3df8445..d6737424b 100644 --- a/src/js/controllers/app.controller.js +++ b/src/js/controllers/app.controller.js @@ -157,6 +157,7 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker, } } + function handleRippleLines(data) { $scope.$apply(function () { @@ -165,7 +166,7 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker, for (var n = 0, l = data.lines.length; n < l; n++) { var line = data.lines[n]; - if (isSignificantLine(line)) { + if ($scope.isSignificantLine(line)) { // XXX: This reinterpretation of the server response should be in the // library upstream. line = $.extend({}, line, { @@ -446,15 +447,6 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker, } } - // Current user doesn't care about a line where he/she's in a default state, - // limits are zero but the counterparty is not in a default state (has a non default flag) - function isSignificantLine(line) { - var DefaultRipple = $scope.account.Flags & ripple.Remote.flags.account_root.DefaultRipple; - - return line.balance !== 0 || line.limit !== 0 || line.limit_peer !== 0 - || DefaultRipple === line.no_ripple; - } - function updateLines(effects) { if (!$.isArray(effects)) return; @@ -574,6 +566,18 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker, }); }); } + // Current user doesn't care about a line where he/she's in a default state, + // limits are zero but the counterparty is not in a default state (has a non default flag) + $scope.isSignificantLine = function(line) { + var DefaultRipple = $scope.account.Flags & ripple.Remote.flags.account_root.DefaultRipple; + + if (typeof line.balance === 'object') { + return !line.balance.is_zero() || !line.limit.is_zero() || !line.limit_peer.is_zero() + || $scope.acctDefaultRippleFlag === line.no_ripple; + } + return line.balance !== 0 || line.limit !== 0 || line.limit_peer !== 0 + || DefaultRipple === line.no_ripple; + } /** * Integrations diff --git a/src/js/tabs/trust.controller.js b/src/js/tabs/trust.controller.js index 30a5efefe..7bb2fab45 100644 --- a/src/js/tabs/trust.controller.js +++ b/src/js/tabs/trust.controller.js @@ -67,7 +67,7 @@ TrustTab.prototype.angular = function (module) // User should not even be able to try granting a trust if the reserve is insufficient $scope.$watch('account', function() { // Check if account has DefaultRipple flag set - $scope.acctDefaultRippleFlag = ($scope.account.Flags & ripple.Remote.flags.account_root.DefaultRipple) + $scope.acctDefaultRippleFlag = ($scope.account.Flags & ripple.Remote.flags.account_root.DefaultRipple); $scope.can_add_trust = false; if ($scope.account.Balance && $scope.account.reserve_to_add_trust) { @@ -325,11 +325,14 @@ TrustTab.prototype.angular = function (module) var obj = {}; _.each($scope.lines, function(line){ - if (!obj[line.currency]) { - obj[line.currency] = { components: [] }; - } - obj[line.currency].components.push(line); + if ($scope.isSignificantLine(line)) { + if (!obj[line.currency]) { + obj[line.currency] = { components: [] }; + } + + obj[line.currency].components.push(line); + } }); $scope.accountLines = obj; diff --git a/src/templates/tabs/trust.jade b/src/templates/tabs/trust.jade index 482fc712f..820b6674b 100644 --- a/src/templates/tabs/trust.jade +++ b/src/templates/tabs/trust.jade @@ -56,7 +56,7 @@ section.col-xs-12.content(ng-controller="TrustCtrl") | to add a new trust line. a(href="https://ripple.com/wiki/Reserves", target="_blank") More information .row(ng-show='connected') - .col-sm-9.trust-menu + .trust-menu .row.row-padding-small.head(ng-hide='true') .col-sm-5(l10n) Name / Address .col-sm-2