Browse Source

preserve order of notifications

activeAddress
Ivan Socolsky 10 years ago
parent
commit
226f18d345
  1. 36
      lib/server.js

36
lib/server.js

@ -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() {

Loading…
Cancel
Save