Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: edit recovery flow #2824

Merged
merged 13 commits into from
Nov 23, 2023
Merged

feat: edit recovery flow #2824

merged 13 commits into from
Nov 23, 2023

Conversation

iamacook
Copy link
Member

What it solves

Resolves #2761

How this PR fixes it

This modifies the EditRecoveryFlow to be UpsertRecoveryFlow which now handles editing a recovery Delay Modifier.

How to test it

Open a Safe with a deployed recovery Delay Modifier and navigate to the (note: temporary) settings, observing the edit button that successfully transactions/alters the settings.

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@iamacook iamacook requested a review from katspaugh November 20, 2023 15:52
@iamacook iamacook linked an issue Nov 20, 2023 that may be closed by this pull request
2 tasks
Copy link

github-actions bot commented Nov 20, 2023

Branch preview

⏳ Deploying a preview site...

Copy link

github-actions bot commented Nov 20, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Nov 20, 2023

Coverage report

❌ An unexpected error occurred. For more details, check console

Error: The process '/usr/local/bin/yarn' failed with exit code 1
St.
Category Percentage Covered / Total
🟡 Statements
75.32% (+0.04% 🔼)
10797/14334
🔴 Branches
50.05% (+0.03% 🔼)
2187/4370
🔴 Functions
57.95% (+0.12% 🔼)
1618/2792
🟡 Lines
76.78% (+0.02% 🔼)
9787/12747
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟡
... / UpsertRecoveryFlowEmailHint.tsx
60% 100% 0% 60%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / setup.ts
91.38% (-8.62% 🔻)
80% (-20% 🔻)
91.67% (-8.33% 🔻)
90.57% (-9.43% 🔻)

Test suite run failed

Failed tests: 5/1226. Failed suites: 2/174.
  ● RecoveryModal › component › should render the in-progress modal when there is a queue for guardians

    expect(received).toBeTruthy()

    Received: null

      76 |
      77 |       expect(queryByText('Test')).toBeTruthy()
    > 78 |       expect(queryByText('Account recovery in progress')).toBeTruthy()
         |                                                           ^
      79 |     })
      80 |
      81 |     it('should render the in-progress modal when there is a queue for owners', () => {

      at Object.toBeTruthy (src/components/recovery/RecoveryModal/index.test.tsx:78:59)

  ● RecoveryModal › component › should render the in-progress modal when there is a queue for owners

    expect(received).toBeTruthy()

    Received: null

      90 |
      91 |       expect(queryByText('Test')).toBeTruthy()
    > 92 |       expect(queryByText('Account recovery in progress')).toBeTruthy()
         |                                                           ^
      93 |     })
      94 |
      95 |     it('should render the proposal modal when there is no queue for guardians', () => {

      at Object.toBeTruthy (src/components/recovery/RecoveryModal/index.test.tsx:92:59)

  ● RecoveryModal › component › should close the modal when the user navigates away

    expect(received).toBeTruthy()

    Received: null

      143 |
      144 |       expect(queryByText('Test')).toBeTruthy()
    > 145 |       expect(queryByText('Account recovery in progress')).toBeTruthy()
          |                                                           ^
      146 |
      147 |       // Trigger the route change
      148 |       mockUseRouter.events.on.mock.calls[0][1]()

      at Object.toBeTruthy (src/components/recovery/RecoveryModal/index.test.tsx:145:59)


  ● RecoveryHeader › should render the in-progress widget if there is a queue for guardians

    expect(received).toBeTruthy()

    Received: null

      29 |     )
      30 |
    > 31 |     expect(queryByText('Account recovery in progress')).toBeTruthy()
         |                                                         ^
      32 |   })
      33 |
      34 |   it('should render the in-progress widget if there is a queue for owners', () => {

      at Object.toBeTruthy (src/components/dashboard/RecoveryHeader/index.test.tsx:31:57)

  ● RecoveryHeader › should render the in-progress widget if there is a queue for owners

    expect(received).toBeTruthy()

    Received: null

      42 |     )
      43 |
    > 44 |     expect(queryByText('Account recovery in progress')).toBeTruthy()
         |                                                         ^
      45 |   })
      46 |
      47 |   it('should render the proposal widget when there is no queue for guardians', () => {

      at Object.toBeTruthy (src/components/dashboard/RecoveryHeader/index.test.tsx:44:57)

Report generated by 🧪jest coverage report action from fdeb566

Copy link

github-actions bot commented Nov 22, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Comment on lines +14 to +19
export enum UpsertRecoveryFlowFields {
guardian = 'guardian',
txCooldown = 'txCooldown',
txExpiration = 'txExpiration',
emailAddress = 'emailAddress',
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these field names arbitrary or they actually map to ABI params?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All but guardian map to the ABI.

Copy link
Member

@katspaugh katspaugh Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to move that to services/recovery then. Or somehow import the ABI here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only relevant for the fields in this flow though.


const onEdit = () => {
// TODO: Display flow
setTxFlow(undefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to add the UpsertRecoveryFlow here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, good catch. I've added it in 09cad6f.

@@ -68,13 +67,16 @@ const headCells = [
{ id: HeadCells.Actions, label: '', sticky: true },
]

// TODO: Migrate section
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still valid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the settings need to be merged with spending limits. I've clarified the comment in 09cad6f.

txData.push(enableModule)

// Add guardian to cache
_guardians.push(guardianToAdd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need to add these to the cache?
The guardiansToAdd addresses can not be part of the guardiansToRemove. So they will never be relevant for removing a guardian.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I've removed it in 09cad6f.

@iamacook iamacook requested a review from schmanu November 23, 2023 10:43
@iamacook iamacook requested a review from katspaugh November 23, 2023 10:58
Copy link

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@iamacook iamacook merged commit 5cabe00 into recovery-epic Nov 23, 2023
4 of 12 checks passed
@iamacook iamacook deleted the edit-recovery-flow branch November 23, 2023 11:28
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Recovery] Edit module flow
3 participants