Commit 6182154
feat: disable revoke button while tx pending (#37559)
## **Description**
This PR extends the gatar permission revocation UI to dynamically
determine if the revoke CTA should be disabled when a transaction to
revoke said permission is pending.
- Extends the gator permission selector file to read
`pendingRevocations` from `GatorPermissionsController`
- Extends the `ReviewGatorPermissionItem` component props to include
`pendingRevocations` values
- Extends the `ReviewGatorPermissionItem` logic to render button text
and determine button disabled status dynamically
## **Related issues**
Relates to: #37209
Requires: MetaMask/core#7055
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
https://github.com/user-attachments/assets/5b65766b-8e8b-4d4e-b7a4-26f52fb60f19
### **After**
https://github.com/user-attachments/assets/92ff11a6-a01d-43b8-bcdf-6b3242252408
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Disables the Gator permission "Revoke" action when a matching
revocation tx is pending via a new selector, with updated UI text and
tests.
>
> - **UI (Gator Permissions)**:
> - `ReviewGatorPermissionItem`: use `getPendingRevocations` to compute
`isPendingRevocation` by `permissionResponse.context` and:
> - Disable `Revoke` button and switch label to
`t('gatorPermissionsRevocationPending')` with muted color when pending.
> - Replace wrapper with `Button` for the revoke CTA.
> - **Selectors**:
> - Add `getPendingRevocations` in
`ui/selectors/gator-permissions/gator-permissions.ts` to read
`metamask.pendingRevocations`.
> - **i18n**:
> - Add messages: `gatorPermissionsRevocationPending`,
`gatorPermissionsRevoke` in `app/_locales/en*.json`.
> - **Tests/Snapshots**:
> - Update `review-gator-permission-item.test.tsx` to mock
`getPendingRevocations`; adjust snapshots for button changes.
> - Add unit tests for `getPendingRevocations` in
`gator-permissions.test.ts`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ff6c481. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: jeffsmale90 <[email protected]>1 parent 0525939 commit 6182154
File tree
7 files changed
+112
-28
lines changed- app/_locales
- en_GB
- en
- ui
- components/multichain/pages/gator-permissions/components
- __snapshots__
- selectors/gator-permissions
7 files changed
+112
-28
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
208 | | - | |
| 210 | + | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| |||
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
377 | | - | |
378 | | - | |
379 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
380 | 383 | | |
381 | 384 | | |
382 | 385 | | |
383 | 386 | | |
384 | 387 | | |
385 | 388 | | |
386 | | - | |
| 389 | + | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
| |||
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
555 | | - | |
556 | | - | |
557 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
558 | 562 | | |
559 | 563 | | |
560 | 564 | | |
561 | 565 | | |
562 | 566 | | |
563 | 567 | | |
564 | | - | |
| 568 | + | |
565 | 569 | | |
566 | 570 | | |
567 | 571 | | |
| |||
730 | 734 | | |
731 | 735 | | |
732 | 736 | | |
733 | | - | |
734 | | - | |
735 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
736 | 741 | | |
737 | 742 | | |
738 | 743 | | |
739 | 744 | | |
740 | 745 | | |
741 | 746 | | |
742 | | - | |
| 747 | + | |
743 | 748 | | |
744 | 749 | | |
745 | 750 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
Lines changed: 29 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
149 | 159 | | |
150 | 160 | | |
151 | 161 | | |
| |||
354 | 364 | | |
355 | 365 | | |
356 | 366 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
| 367 | + | |
362 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
363 | 375 | | |
364 | | - | |
365 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
366 | 387 | | |
367 | | - | |
| 388 | + | |
368 | 389 | | |
369 | 390 | | |
370 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1502 | 1503 | | |
1503 | 1504 | | |
1504 | 1505 | | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
1505 | 1529 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
0 commit comments