From b8a708c8631f2f5e37189d24d77653f2d7817046 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Wed, 5 Nov 2014 22:21:32 -0300 Subject: [PATCH] fixed whenAvailable() --- js/models/RateService.js | 2 +- js/models/TxProposal.js | 1 + js/models/Wallet.js | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/js/models/RateService.js b/js/models/RateService.js index 29fd21971..048acb7dd 100644 --- a/js/models/RateService.js +++ b/js/models/RateService.js @@ -89,7 +89,7 @@ RateService.prototype.isAvailable = function() { }; RateService.prototype.whenAvailable = function(callback) { - if (!this.isAvailable()) { + if (this.isAvailable()) { setTimeout(callback, 1); } else { this._queued.push(callback); diff --git a/js/models/TxProposal.js b/js/models/TxProposal.js index ae9de2dd9..5f806f8bb 100644 --- a/js/models/TxProposal.js +++ b/js/models/TxProposal.js @@ -37,6 +37,7 @@ function TxProposal(opts) { this.comment = opts.comment || null; this.readonly = opts.readonly || null; this.merchant = opts.merchant || null; + this.altCurrency = opts.altCurrency || null; this._sync(); } diff --git a/js/models/Wallet.js b/js/models/Wallet.js index c1d4b876e..6f66162f6 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2866,19 +2866,23 @@ Wallet.prototype.getTransactionHistory = function(cb) { type: 'out' }); - var proposal = _.findWhere(proposals, { - sentTxid: tx.txid - }); - tx.comment = proposal ? proposal.comment : undefined; tx.labelTo = firstOut ? firstOut.label : undefined; tx.addressTo = firstOut ? firstOut.address : undefined; tx.amountSat = Math.abs(amount); tx.amount = tx.amountSat * satToUnit; - tx.sentTs = proposal ? proposal.sentTs : undefined; tx.minedTs = !_.isNaN(tx.time) ? tx.time * 1000 : undefined; - tx.merchant = proposal ? proposal.merchant : undefined; - tx.peerActions = proposal ? proposal.peerActions : undefined; - tx.finallyRejected = proposal ? proposal.finallyRejected : undefined; + + var proposal = _.findWhere(proposals, { + sentTxid: tx.txid + }); + + if (proposal) { + tx.comment = proposal.comment; + tx.sentTs = proposal.sentTs; + tx.merchant = proposal.merchant; + tx.peerActions = proposal.peerActions; + tx.finallyRejected = proposal.finallyRejected; + } }; if (addresses.length > 0) {