1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +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": {
"message": "Reject all"
},
"rejectRequestsDescription": {
"message": "You are about to batch reject $1 requests."
},
"rejectRequestsN": {
"message": "Reject $1 requests"
},
"rejectTxsDescription": {
"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,
hideModal: PropTypes.func.isRequired,
unapprovedTxCount: PropTypes.number.isRequired,
isRequestType: PropTypes.bool,
};
onSubmit = async () => {
@ -22,11 +23,15 @@ export default class RejectTransactionsModal extends PureComponent {
render() {
const { t } = this.context;
const { hideModal, unapprovedTxCount } = this.props;
const { hideModal, unapprovedTxCount, isRequestType } = this.props;
return (
<Modal
headerText={t('rejectTxsN', [unapprovedTxCount])}
headerText={
isRequestType
? t('rejectRequestsN', [unapprovedTxCount])
: t('rejectTxsN', [unapprovedTxCount])
}
onClose={hideModal}
onSubmit={this.onSubmit}
onCancel={hideModal}
@ -35,7 +40,9 @@ export default class RejectTransactionsModal extends PureComponent {
>
<div>
<div className="reject-transactions__description">
{t('rejectTxsDescription', [unapprovedTxCount])}
{isRequestType
? t('rejectRequestsDescription', [unapprovedTxCount])
: t('rejectTxsDescription', [unapprovedTxCount])}
</div>
</div>
</Modal>

View File

@ -179,7 +179,7 @@ exports[`SignatureRequestOriginal should match snapshot 1`] = `
role="button"
tabindex="0"
>
Cancel
Reject
</button>
<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);
}}
>
{t('cancel')}
{t('reject')}
</Button>
<Button
data-testid="request-signature__sign"
@ -344,7 +344,7 @@ export default class SignatureRequestOriginal extends Component {
render = () => {
const { messagesCount } = this.props;
const { t } = this.context;
const rejectNText = t('rejectTxsN', [messagesCount]);
const rejectNText = t('rejectRequestsN', [messagesCount]);
return (
<div className="request-signature__container">
{this.renderHeader()}

View File

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

View File

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