Skip to content

Commit e8ca82b

Browse files
authored
fix: cp-12.18.0 Update reject data on rejectAllApprovals utility (#32466)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR fixes the unintentionally removed rejection data `cause` property back into `rejectAllApprovals` utility. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/32466?quickstart=1) ## **Related issues** Fixes: #32162 ## **Manual testing steps** 1. Go to test-dapp 2. Trigger 3 transaction request back to back 3. Use reject all in the last one 4. Be able to trigger another transaction after "rejecting all" ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent eec14db commit e8ca82b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

app/scripts/lib/approval/utils.test.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { rejectAllApprovals, rejectOriginApprovals } from './utils';
1212
const ID_MOCK = '123';
1313
const ID_MOCK_2 = '456';
1414
const INTERFACE_ID_MOCK = '789';
15+
const REJECT_ALL_APPROVALS_DATA = {
16+
data: {
17+
cause: 'rejectAllApprovals',
18+
},
19+
};
1520

1621
function createApprovalControllerMock(
1722
pendingApprovals: Partial<ApprovalRequest<Record<string, Json>>>[],
@@ -40,11 +45,11 @@ describe('Approval Utils', () => {
4045
expect(approvalController.reject).toHaveBeenCalledTimes(2);
4146
expect(approvalController.reject).toHaveBeenCalledWith(
4247
ID_MOCK,
43-
providerErrors.userRejectedRequest(),
48+
providerErrors.userRejectedRequest(REJECT_ALL_APPROVALS_DATA),
4449
);
4550
expect(approvalController.reject).toHaveBeenCalledWith(
4651
ID_MOCK_2,
47-
providerErrors.userRejectedRequest(),
52+
providerErrors.userRejectedRequest(REJECT_ALL_APPROVALS_DATA),
4853
);
4954
});
5055

@@ -122,7 +127,7 @@ describe('Approval Utils', () => {
122127
expect(approvalController.reject).toHaveBeenCalledTimes(1);
123128
expect(approvalController.reject).toHaveBeenCalledWith(
124129
ID_MOCK,
125-
providerErrors.userRejectedRequest(),
130+
providerErrors.userRejectedRequest(REJECT_ALL_APPROVALS_DATA),
126131
);
127132
});
128133
});

app/scripts/lib/approval/utils.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ function rejectApproval({
9494

9595
default:
9696
log('Rejecting pending approval', { id, origin, type });
97-
approvalController.reject(id, providerErrors.userRejectedRequest());
97+
approvalController.reject(
98+
id,
99+
providerErrors.userRejectedRequest({
100+
data: {
101+
cause: 'rejectAllApprovals',
102+
},
103+
}),
104+
);
98105
break;
99106
}
100107
}

0 commit comments

Comments
 (0)