From c4b293ed3a37f8b4aa74ad27adb4b0a79514ede0 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 22 Sep 2016 10:11:37 -0300 Subject: [PATCH] return txnote after edit --- lib/server.js | 5 ++++- test/integration/server.js | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/server.js b/lib/server.js index c938e41..9d6890c 100644 --- a/lib/server.js +++ b/lib/server.js @@ -2068,7 +2068,10 @@ WalletService.prototype.editTxNote = function(opts, cb) { } else { note.edit(opts.body, self.copayerId); } - self.storage.storeTxNote(note, cb); + self.storage.storeTxNote(note, function(err) { + if (err) return cb(err); + self.storage.fetchTxNote(self.walletId, opts.txid, cb); + }); }); }); }; diff --git a/test/integration/server.js b/test/integration/server.js index 0d513bf..1557d69 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -3761,19 +3761,21 @@ describe('Wallet service', function() { server.editTxNote({ txid: '123', body: 'note body' - }, function(err) { + }, function(err, note) { should.not.exist(err); + note.txid.should.equal('123'); + note.walletId.should.equal(wallet.id); + note.body.should.equal('note body'); + note.editedBy.should.equal(server.copayerId); + note.editedByName.should.equal('copayer 1'); + note.createdOn.should.equal(note.editedOn); server.getTxNote({ txid: '123', }, function(err, note) { should.not.exist(err); should.exist(note); - note.txid.should.equal('123'); - note.walletId.should.equal(wallet.id); note.body.should.equal('note body'); note.editedBy.should.equal(server.copayerId); - note.editedByName.should.equal('copayer 1'); - note.createdOn.should.equal(note.editedOn); done(); }); });