mirror of https://github.com/BTCPrivate/copay.git
allow to rm comment
This commit is contained in:
parent
b1a15d56c0
commit
7ef07bc0ee
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $ionicPopup, gettextCatalog, profileService, configService) {
|
||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $ionicPopup, gettextCatalog, profileService, configService, lodash) {
|
||||
|
||||
var self = $scope.self;
|
||||
var fc = profileService.focusedClient;
|
||||
|
@ -14,7 +14,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
$scope.isShared = fc.credentials.n > 1;
|
||||
$scope.showCommentPopup = function() {
|
||||
$scope.data = {
|
||||
comment: $scope.btx.note ? $scope.btx.note.body : '',
|
||||
comment: $scope.btx.note ? $scope.btx.note.body : '',
|
||||
};
|
||||
|
||||
var commentPopup = $ionicPopup.show({
|
||||
|
@ -28,19 +28,27 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
|
||||
$scope.commentPopupSave = function() {
|
||||
$log.debug('Saving note');
|
||||
fc.editTxNote({
|
||||
var args = {
|
||||
txid: $scope.btx.txid,
|
||||
body: $scope.data.comment,
|
||||
}, function(err) {
|
||||
};
|
||||
|
||||
if (!lodash.isEmpty($scope.data.comment)) {
|
||||
args.body = $scope.data.comment;
|
||||
};
|
||||
|
||||
fc.editTxNote(args, function(err) {
|
||||
if (err) {
|
||||
$log.debug('Could not save tx comment');
|
||||
return;
|
||||
}
|
||||
// This is only to refresh the current screen data
|
||||
$scope.btx.note = {};
|
||||
$scope.btx.note.body = $scope.data.comment;
|
||||
$scope.btx.note.editedByName = fc.credentials.copayerName;
|
||||
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
|
||||
$scope.btx.note = null;
|
||||
if (args.body) {
|
||||
$scope.btx.note = {};
|
||||
$scope.btx.note.body = $scope.data.comment;
|
||||
$scope.btx.note.editedByName = fc.credentials.copayerName;
|
||||
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
|
||||
}
|
||||
$scope.btx.searcheableString = null;
|
||||
commentPopup.close();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue