Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3568 Show borrow window for owner for testing purpose and prevent su… #3597

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 7 additions & 18 deletions app/components/Account/CreditOffer/CreditOfferPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,6 @@ class CreditOfferPage extends React.Component {
}

showAcceptModal(data) {
// console.log("TODO:", data);
let {currentAccount} = this.props;
let account = ChainStore.getAccount(currentAccount);
if (account.get("id") == data.owner_account) {
notify.addNotification.defer({
children: (
<Translate
component="span"
content="credit_offer.info_borrow_err"
/>
),
level: "error",
autoDismiss: 3
});
return;
}

let assetList = data.acceptable_collateral.map(v => v[0]);
let debtAsset = data.asset_type;
let selectAsset = assetList[0];
Expand Down Expand Up @@ -472,7 +455,7 @@ class CreditOfferPage extends React.Component {
let maxReal = maxAssetAmount.getAmount({real: true});
let maxError = amount > maxReal || maxReal <= 0;
const isSubmitNotValid =
!amount || minError || maxError || !selectAsset || balanceError;
!amount || minError || maxError || !selectAsset || balanceError || account.get("id") == info.owner_account;
let _error = maxError ? "has-error" : "";
if (currentBalance && currentBalance > 0) {
balance = (
Expand Down Expand Up @@ -521,6 +504,12 @@ class CreditOfferPage extends React.Component {
overlay={true}
onCancel={this.hideAcceptModal}
footer={[
info.owner_account === info.owner_account && (
<Translate
component="span"
content="credit_offer.info_borrow_err"
/>
) || null,
<Button
key={"send"}
disabled={isSubmitNotValid}
Expand Down