diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index a77a95b26..3186a7f4b 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -27,16 +27,23 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio }; function updateMemo() { - wallet.getTxNote({ - txid: $scope.btx.txid - }, function(err, note) { + walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) { if (err || !note) { $log.debug(gettextCatalog.getString('Could not fetch transaction note')); return; } - $scope.note = note; - $timeout(function() { - $scope.$apply(); + $scope.btx.note = note; + + walletService.getTx(wallet, $scope.btx.txid, function(err, tx) { + if (err) { + $log.error(err); + return; + } + + tx.note = note; + $timeout(function() { + $scope.$apply(); + }); }); }); }; @@ -91,19 +98,13 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio body: text }; - wallet.editTxNote(args, function(err) { + walletService.editTxNote(wallet, args, function(err, res) { if (err) { $log.debug('Could not save tx comment'); return; } // This is only to refresh the current screen data - $scope.btx.note = null; - if (args.body) { - $scope.btx.note = {}; - $scope.btx.note.body = text; - $scope.btx.note.editedByName = wallet.credentials.copayerName; - $scope.btx.note.editedOn = Math.floor(Date.now() / 1000); - } + updateMemo(); $scope.btx.searcheableString = null; $timeout(function() { $scope.$apply(); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 84bfea06a..173ed6bec 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -512,6 +512,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim }); }; + root.editTxNote = function(wallet, args, cb) { + wallet.editTxNote(args, function(err, res) { + return cb(err, res); + }); + }; + root.getTxp = function(wallet, txpid, cb) { wallet.getTx(txpid, function(err, txp) { if (err) return cb(err); diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index 135287375..595f4b250 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -124,7 +124,7 @@
-
+
+