1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Renamed setApproveForAllArg variable to be isApprovalOrRejection (#16012)

This commit is contained in:
Filip Sekulic 2022-10-04 20:37:11 +02:00 committed by GitHub
parent 393088e669
commit 76af0f4d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 17 deletions

View File

@ -108,7 +108,7 @@ export default class ConfirmPageContainer extends Component {
nativeCurrency: PropTypes.string, nativeCurrency: PropTypes.string,
showBuyModal: PropTypes.func, showBuyModal: PropTypes.func,
isBuyableChain: PropTypes.bool, isBuyableChain: PropTypes.bool,
setApproveForAllArg: PropTypes.bool, isApprovalOrRejection: PropTypes.bool,
}; };
render() { render() {
@ -165,7 +165,7 @@ export default class ConfirmPageContainer extends Component {
showBuyModal, showBuyModal,
isBuyableChain, isBuyableChain,
networkIdentifier, networkIdentifier,
setApproveForAllArg, isApprovalOrRejection,
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
insightComponent, insightComponent,
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
@ -339,7 +339,7 @@ export default class ConfirmPageContainer extends Component {
<ErrorMessage errorKey={errorKey} /> <ErrorMessage errorKey={errorKey} />
</div> </div>
)} )}
{isSetApproveForAll && setApproveForAllArg && ( {isSetApproveForAll && isApprovalOrRejection && (
<Dialog type="error" className="confirm-page-container__dialog"> <Dialog type="error" className="confirm-page-container__dialog">
{/* {/*
TODO: https://github.com/MetaMask/metamask-extension/issues/15745 TODO: https://github.com/MetaMask/metamask-extension/issues/15745

View File

@ -75,7 +75,7 @@ export default class ConfirmApproveContent extends Component {
tokenId: PropTypes.string, tokenId: PropTypes.string,
assetStandard: PropTypes.string, assetStandard: PropTypes.string,
isSetApproveForAll: PropTypes.bool, isSetApproveForAll: PropTypes.bool,
setApproveForAllArg: PropTypes.bool, isApprovalOrRejection: PropTypes.bool,
userAddress: PropTypes.string, userAddress: PropTypes.string,
}; };
@ -307,7 +307,7 @@ export default class ConfirmApproveContent extends Component {
renderDataContent() { renderDataContent() {
const { t } = this.context; const { t } = this.context;
const { data, isSetApproveForAll, setApproveForAllArg } = this.props; const { data, isSetApproveForAll, isApprovalOrRejection } = this.props;
return ( return (
<div className="flex-column"> <div className="flex-column">
<div className="confirm-approve-content__small-text"> <div className="confirm-approve-content__small-text">
@ -315,9 +315,9 @@ export default class ConfirmApproveContent extends Component {
? t('functionSetApprovalForAll') ? t('functionSetApprovalForAll')
: t('functionApprove')} : t('functionApprove')}
</div> </div>
{isSetApproveForAll && setApproveForAllArg !== undefined ? ( {isSetApproveForAll && isApprovalOrRejection !== undefined ? (
<div className="confirm-approve-content__small-text"> <div className="confirm-approve-content__small-text">
{`${t('parameters')}: ${setApproveForAllArg}`} {`${t('parameters')}: ${isApprovalOrRejection}`}
</div> </div>
) : null} ) : null}
<div className="confirm-approve-content__small-text confirm-approve-content__data__data-block"> <div className="confirm-approve-content__small-text confirm-approve-content__data__data-block">
@ -531,14 +531,14 @@ export default class ConfirmApproveContent extends Component {
renderTitle() { renderTitle() {
const { t } = this.context; const { t } = this.context;
const { isSetApproveForAll, setApproveForAllArg } = this.props; const { isSetApproveForAll, isApprovalOrRejection } = this.props;
const titleTokenDescription = this.getTitleTokenDescription(); const titleTokenDescription = this.getTitleTokenDescription();
let title; let title;
if (isSetApproveForAll) { if (isSetApproveForAll) {
title = t('approveAllTokensTitle', [titleTokenDescription]); title = t('approveAllTokensTitle', [titleTokenDescription]);
if (setApproveForAllArg === false) { if (isApprovalOrRejection === false) {
title = t('revokeAllTokensTitle', [titleTokenDescription]); title = t('revokeAllTokensTitle', [titleTokenDescription]);
} }
} }
@ -547,14 +547,15 @@ export default class ConfirmApproveContent extends Component {
renderDescription() { renderDescription() {
const { t } = this.context; const { t } = this.context;
const { isContract, isSetApproveForAll, setApproveForAllArg } = this.props; const { isContract, isSetApproveForAll, isApprovalOrRejection } =
this.props;
const grantee = isContract const grantee = isContract
? t('contract').toLowerCase() ? t('contract').toLowerCase()
: t('account').toLowerCase(); : t('account').toLowerCase();
let description = t('trustSiteApprovePermission', [grantee]); let description = t('trustSiteApprovePermission', [grantee]);
if (isSetApproveForAll && setApproveForAllArg === false) { if (isSetApproveForAll && isApprovalOrRejection === false) {
description = t('revokeApproveForAllDescription', [ description = t('revokeApproveForAllDescription', [
grantee, grantee,
this.getTitleTokenDescription(), this.getTitleTokenDescription(),

View File

@ -155,7 +155,7 @@ export default function ConfirmApprove({
const parsedTransactionData = const parsedTransactionData =
parseStandardTokenTransactionData(transactionData); parseStandardTokenTransactionData(transactionData);
const setApproveForAllArg = getTokenApprovedParam(parsedTransactionData); const isApprovalOrRejection = getTokenApprovedParam(parsedTransactionData);
return tokenSymbol === undefined && assetName === undefined ? ( return tokenSymbol === undefined && assetName === undefined ? (
<Loading /> <Loading />
@ -170,13 +170,13 @@ export default function ConfirmApprove({
customTokenAmount={String(customPermissionAmount)} customTokenAmount={String(customPermissionAmount)}
dappProposedTokenAmount={tokenAmount} dappProposedTokenAmount={tokenAmount}
currentTokenBalance={tokenBalance} currentTokenBalance={tokenBalance}
setApproveForAllArg={setApproveForAllArg} isApprovalOrRejection={isApprovalOrRejection}
contentComponent={ contentComponent={
<TransactionModalContextProvider> <TransactionModalContextProvider>
<ConfirmApproveContent <ConfirmApproveContent
userAddress={userAddress} userAddress={userAddress}
isSetApproveForAll={isSetApproveForAll} isSetApproveForAll={isSetApproveForAll}
setApproveForAllArg={setApproveForAllArg} isApprovalOrRejection={isApprovalOrRejection}
decimals={decimals} decimals={decimals}
siteImage={siteImage} siteImage={siteImage}
setCustomAmount={setCustomPermissionAmount} setCustomAmount={setCustomPermissionAmount}

View File

@ -161,7 +161,7 @@ export default class ConfirmTransactionBase extends Component {
eip1559V2Enabled: PropTypes.bool, eip1559V2Enabled: PropTypes.bool,
showBuyModal: PropTypes.func, showBuyModal: PropTypes.func,
isBuyableChain: PropTypes.bool, isBuyableChain: PropTypes.bool,
setApproveForAllArg: PropTypes.bool, isApprovalOrRejection: PropTypes.bool,
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
insightSnaps: PropTypes.arrayOf(PropTypes.object), insightSnaps: PropTypes.arrayOf(PropTypes.object),
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
@ -1127,7 +1127,7 @@ export default class ConfirmTransactionBase extends Component {
nativeCurrency, nativeCurrency,
hardwareWalletRequiresConnection, hardwareWalletRequiresConnection,
image, image,
setApproveForAllArg, isApprovalOrRejection,
assetStandard, assetStandard,
} = this.props; } = this.props;
const { const {
@ -1232,7 +1232,7 @@ export default class ConfirmTransactionBase extends Component {
currentTransaction={txData} currentTransaction={txData}
supportsEIP1559V2={this.supportsEIP1559V2} supportsEIP1559V2={this.supportsEIP1559V2}
nativeCurrency={nativeCurrency} nativeCurrency={nativeCurrency}
setApproveForAllArg={setApproveForAllArg} isApprovalOrRejection={isApprovalOrRejection}
assetStandard={assetStandard} assetStandard={assetStandard}
/> />
</TransactionModalContextProvider> </TransactionModalContextProvider>