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

Fix: multiple reject on the signature request screen (#16199)

Co-authored-by: Brad Decker <bhdecker84@gmail.com>
This commit is contained in:
amerkadicE 2022-11-30 08:13:14 +01:00 committed by GitHub
parent 9a434aed5e
commit 505517e8c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 7 deletions

View File

@ -2889,6 +2889,12 @@
"rejectAll": { "rejectAll": {
"message": "Reject all" "message": "Reject all"
}, },
"rejectRequestsDescription": {
"message": "You are about to batch reject $1 requests."
},
"rejectRequestsN": {
"message": "Reject $1 requests"
},
"rejectTxsDescription": { "rejectTxsDescription": {
"message": "You are about to batch reject $1 transactions." "message": "You are about to batch reject $1 transactions."
}, },

View File

@ -11,6 +11,7 @@ export default class RejectTransactionsModal extends PureComponent {
onSubmit: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired,
hideModal: PropTypes.func.isRequired, hideModal: PropTypes.func.isRequired,
unapprovedTxCount: PropTypes.number.isRequired, unapprovedTxCount: PropTypes.number.isRequired,
isRequestType: PropTypes.bool,
}; };
onSubmit = async () => { onSubmit = async () => {
@ -22,11 +23,15 @@ export default class RejectTransactionsModal extends PureComponent {
render() { render() {
const { t } = this.context; const { t } = this.context;
const { hideModal, unapprovedTxCount } = this.props; const { hideModal, unapprovedTxCount, isRequestType } = this.props;
return ( return (
<Modal <Modal
headerText={t('rejectTxsN', [unapprovedTxCount])} headerText={
isRequestType
? t('rejectRequestsN', [unapprovedTxCount])
: t('rejectTxsN', [unapprovedTxCount])
}
onClose={hideModal} onClose={hideModal}
onSubmit={this.onSubmit} onSubmit={this.onSubmit}
onCancel={hideModal} onCancel={hideModal}
@ -35,7 +40,9 @@ export default class RejectTransactionsModal extends PureComponent {
> >
<div> <div>
<div className="reject-transactions__description"> <div className="reject-transactions__description">
{t('rejectTxsDescription', [unapprovedTxCount])} {isRequestType
? t('rejectRequestsDescription', [unapprovedTxCount])
: t('rejectTxsDescription', [unapprovedTxCount])}
</div> </div>
</div> </div>
</Modal> </Modal>

View File

@ -179,7 +179,7 @@ exports[`SignatureRequestOriginal should match snapshot 1`] = `
role="button" role="button"
tabindex="0" tabindex="0"
> >
Cancel Reject
</button> </button>
<button <button
class="button btn--rounded btn-primary btn--large request-signature__footer__sign-button" class="button btn--rounded btn-primary btn--large request-signature__footer__sign-button"

View File

@ -291,7 +291,7 @@ export default class SignatureRequestOriginal extends Component {
history.push(mostRecentOverviewPage); history.push(mostRecentOverviewPage);
}} }}
> >
{t('cancel')} {t('reject')}
</Button> </Button>
<Button <Button
data-testid="request-signature__sign" data-testid="request-signature__sign"
@ -344,7 +344,7 @@ export default class SignatureRequestOriginal extends Component {
render = () => { render = () => {
const { messagesCount } = this.props; const { messagesCount } = this.props;
const { t } = this.context; const { t } = this.context;
const rejectNText = t('rejectTxsN', [messagesCount]); const rejectNText = t('rejectRequestsN', [messagesCount]);
return ( return (
<div className="request-signature__container"> <div className="request-signature__container">
{this.renderHeader()} {this.renderHeader()}

View File

@ -61,6 +61,7 @@ function mapDispatchToProps(dispatch) {
name: 'REJECT_TRANSACTIONS', name: 'REJECT_TRANSACTIONS',
onSubmit, onSubmit,
unapprovedTxCount: messagesCount, unapprovedTxCount: messagesCount,
isRequestType: true,
}), }),
); );
}, },

View File

@ -22,7 +22,7 @@ export default class SignatureRequestFooter extends PureComponent {
type="secondary" type="secondary"
data-testid="signature-cancel-button" data-testid="signature-cancel-button"
> >
{this.context.t('cancel')} {this.context.t('reject')}
</Button> </Button>
<Button <Button
onClick={signAction} onClick={signAction}