This repository was archived by the owner on Sep 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +40
-12
lines changed
Expand file tree Collapse file tree 4 files changed +40
-12
lines changed Original file line number Diff line number Diff line change 1- var types = require ( '../util/types' ) ;
1+ var types = require ( '../util/types' ) ,
2+ rewriter = require ( '../util/jsonrewriter' ) ;
23
34// Load app modules
45require ( '../controllers/app' ) ;
@@ -137,6 +138,8 @@ var app = angular
137138var rippleclient = window . rippleclient = { } ;
138139rippleclient . app = app ;
139140rippleclient . types = types ;
141+ // for unit tests
142+ rippleclient . rewriter = rewriter ;
140143
141144// Install basic page template
142145angular . element ( 'body' ) . prepend ( require ( '../../jade/client/index.jade' ) ( ) ) ;
Original file line number Diff line number Diff line change @@ -332,7 +332,10 @@ TrustTab.prototype.angular = function (module)
332332 }
333333
334334 obj [ line . currency ] . components . push ( line ) ;
335-
335+ // correctly show "Rippling" flag for incoming trust lines
336+ if ( _ . has ( line , 'no_ripple_peer' ) ) {
337+ line . no_ripple = line . no_ripple_peer ;
338+ }
336339 } ) ;
337340
338341 $scope . accountLines = obj ;
Original file line number Diff line number Diff line change @@ -386,20 +386,17 @@ var JsonRewriter = module.exports = {
386386
387387 var high = node . fields . HighLimit ;
388388 var low = node . fields . LowLimit ;
389+ var viewHigh = high . issuer === account ;
389390
390- var which = high . issuer === account ? 'HighNoRipple' : 'LowNoRipple' ;
391+ var which = obj . transaction . type == 'trusting' ? ( high . issuer === account ? 'HighNoRipple' : 'LowNoRipple' ) :
392+ ( high . issuer === account ? 'LowNoRipple' : 'HighNoRipple' ) ;
391393
392394 // New trust line
393395 if ( node . diffType === 'CreatedNode' ) {
394- effect . limit = ripple . Amount . from_json ( high . value > 0 ? high : low ) ;
395- effect . limit_peer = ripple . Amount . from_json ( high . value > 0 ? low : high ) ;
396-
397- if ( ( high . value > 0 && high . issuer === account )
398- || ( low . value > 0 && low . issuer === account ) ) {
399- effect . type = 'trust_create_local' ;
400- } else {
401- effect . type = 'trust_create_remote' ;
402- }
396+ effect . limit = ripple . Amount . from_json ( viewHigh ? high : low ) ;
397+ effect . limit_peer = ripple . Amount . from_json ( viewHigh ? low : high ) ;
398+
399+ effect . type = obj . transaction . type == 'trusting' ? 'trust_create_local' : 'trust_create_remote' ;
403400 }
404401
405402 // Modified trust line
You can’t perform that action at this time.
0 commit comments