fix edit memo

This commit is contained in:
Javier 2016-10-11 16:46:06 -03:00
commit 50287bba2f
3 changed files with 22 additions and 15 deletions

View file

@ -27,18 +27,25 @@ 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;
$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();
});
});
});
};
function initActionList() {
@ -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();

View file

@ -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);

View file

@ -124,7 +124,7 @@
</div>
<div class="card list" ng-show="txHistory[0]">
<div class="item" ng-repeat="btx in txHistory track by btx.txid" ng-click="openTxModal(btx)">
<div class="item" ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
<span class="item-note text-right">
<span class="size-16" ng-class="{'text-bold': btx.recent}">
<span ng-if="btx.action == 'received'">+</span>