Ivan Socolsky
9 years ago
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
2 changed files with
14 additions and
5 deletions
-
lib/storage.js
-
test/integration/server.js
|
|
@ -663,7 +663,7 @@ Storage.prototype.fetchTxNote = function(walletId, txid, cb) { |
|
|
|
txid: txid, |
|
|
|
}, function(err, result) { |
|
|
|
if (err) return cb(err); |
|
|
|
if (!result || !result.body) return cb(); |
|
|
|
if (!result) return cb(); |
|
|
|
return self._completeTxNotesData(walletId, Model.TxNote.fromObj(result), cb); |
|
|
|
}); |
|
|
|
}; |
|
|
@ -699,7 +699,6 @@ Storage.prototype.fetchTxNotes = function(walletId, opts, cb) { |
|
|
|
this.db.collection(collections.TX_NOTES).find(filter).toArray(function(err, result) { |
|
|
|
if (err) return cb(err); |
|
|
|
var notes = _.compact(_.map(result, function(note) { |
|
|
|
if (!note.body) return; |
|
|
|
return Model.TxNote.fromObj(note); |
|
|
|
})); |
|
|
|
return self._completeTxNotesData(walletId, notes, cb); |
|
|
|
|
|
@ -4058,7 +4058,7 @@ describe('Wallet service', function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
it('should be possible to remove a note', function(done) { |
|
|
|
it('should be possible to set an empty note', function(done) { |
|
|
|
server.editTxNote({ |
|
|
|
txid: '123', |
|
|
|
body: 'note body' |
|
|
@ -4078,8 +4078,18 @@ describe('Wallet service', function() { |
|
|
|
txid: '123', |
|
|
|
}, function(err, note) { |
|
|
|
should.not.exist(err); |
|
|
|
should.not.exist(note); |
|
|
|
done(); |
|
|
|
should.exist(note); |
|
|
|
note.should.have.property('body'); |
|
|
|
should.equal(note.body, null); |
|
|
|
server.getTxNotes({ |
|
|
|
minTs: 0 |
|
|
|
}, function(err, notes) { |
|
|
|
should.not.exist(err); |
|
|
|
should.exist(notes); |
|
|
|
notes.length.should.equal(1); |
|
|
|
should.equal(notes[0].body, null); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|