Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

[FIX] Trust: Do not allow incoming lines with balance to disable rippling, show warning message when enabling rippling (RT-3371) #2502

Merged
merged 1 commit into from
May 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/js/tabs/trust.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ TrustTab.prototype.angular = function (module)
$scope.editing = false;
};


$scope.edit_account = function() {
$scope.editing = true;

Expand Down Expand Up @@ -638,6 +637,17 @@ TrustTab.prototype.angular = function (module)
return ($scope.component.limit.is_zero() && !$scope.component.limit_peer.is_zero());
};

$scope.ripplingEnabled = function() {
return !$scope.component.no_ripple;
}

$scope.showEnableRipplingWarningMessage = function() {
return ($scope.isIncomingOnly() &&
!$scope.ripplingEnabled() &&
$scope.trust.rippling &&
$scope.trust.balance !== '0');
}

}]);

};
Expand Down
26 changes: 20 additions & 6 deletions src/templates/tabs/trust.jade
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,28 @@ section.col-xs-12.content(ng-controller="TrustCtrl")
.col-sm-2.col-md-2.inputPadding
div.rippling-checkbox
label(l10n) Rippling 
input(name='rippling', type='checkbox', ng-model='trust.rippling', ng-disabled='trust.balance !== "0" && isIncomingOnly()')
input(name='rippling', type='checkbox', ng-model='trust.rippling', ng-disabled='trust.balance !== "0" && isIncomingOnly() && ripplingEnabled()')
.col-sm-7.col-md-6
.row.row-padding-small
.col-xs-6.col-sm-5(ng-hide="trust.loading && trust.state==='removing'")
button.btn.btn-block.btn-primary#save(type='submit'
ng-disabled='accountForm.$invalid || trust.loading')
span(ng-hide="trust.loading", l10n) Save
span(ng-show="trust.loading && trust.state==='saving'", l10n) Saving...
div(ng-hide="trust.loading && trust.state==='removing'")
.col-xs-6.col-sm-5(ng-hide='showEnableRipplingWarningMessage()')
button.btn.btn-block.btn-primary#save(type='submit'
ng-disabled='accountForm.$invalid || trust.loading')
span(ng-hide="trust.loading", l10n) Save
span(ng-show="trust.loading && trust.state==='saving'", l10n) Saving...
.col-xs-6.col-sm-5(ng-show='showEnableRipplingWarningMessage()')
rp-confirm(
action-text="Are you sure you want to enable rippling? This is an incoming trust line with a balance. If you enable rippling, you will not be able to disable it."
action-button-text="Enable rippling and save"
action-button-css="btn btn-default btn-danger"
action-function="save_account()"
cancel-button-css="btn btn-cancel"
cancel-button-text="cancel"
ng-hide="showPassword==true")
button.btn.btn-block.btn-primary#save(type='submit'
ng-disabled='accountForm.$invalid || trust.loading')
span(ng-hide="trust.loading", l10n) Save
span(ng-show="trust.loading && trust.state==='saving'", l10n) Saving...
.col-xs-6.col-sm-5(ng-show="trust.loading && trust.state==='removing'")
.row
.col-xs-12
Expand Down