preserve order of notifications

This commit is contained in:
Ivan Socolsky 2015-05-14 12:48:19 -03:00
parent d66c0502ce
commit 226f18d345
1 changed files with 18 additions and 18 deletions

View File

@ -424,24 +424,24 @@ WalletService.prototype.joinWallet = function(opts, cb) {
if (err) return cb(err);
async.parallel([
async.series([
function(done) {
function(next) {
self._notify('NewCopayer', {
walletId: opts.walletId,
copayerId: copayer.id,
copayerName: copayer.name,
}, done);
}, next);
},
function(done) {
function(next) {
if (wallet.isComplete() && wallet.isShared()) {
self._notify('WalletComplete', {
walletId: opts.walletId,
}, {
isGlobal: true
}, done);
}, next);
} else {
done();
next();
}
},
], function() {
@ -951,21 +951,21 @@ WalletService.prototype.signTx = function(opts, cb) {
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
async.parallel([
async.series([
function(done) {
function(next) {
self._notify('TxProposalAcceptedBy', {
txProposalId: opts.txProposalId,
copayerId: self.copayerId,
}, done);
}, next);
},
function(done) {
function(next) {
if (txp.isAccepted()) {
self._notify('TxProposalFinallyAccepted', {
txProposalId: opts.txProposalId,
}, done);
}, next);
} else {
done();
next();
}
},
], function() {
@ -1052,21 +1052,21 @@ WalletService.prototype.rejectTx = function(opts, cb) {
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
async.parallel([
async.series([
function(done) {
function(next) {
self._notify('TxProposalRejectedBy', {
txProposalId: opts.txProposalId,
copayerId: self.copayerId,
}, done);
}, next);
},
function(done) {
function(next) {
if (txp.status == 'rejected') {
self._notify('TxProposalFinallyRejected', {
txProposalId: opts.txProposalId,
}, done);
}, next);
} else {
done();
next();
}
},
], function() {