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

Cherry pick 743f5ec pr25306 to v11.16.11 #25333

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Jun 14, 2024

Cherry-picks #25306 (743f5ec) to v11.16.11

…boarding and if basic functionality is off (#25306)

<!--
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.
-->

This fix ensures that network requests for the phishing list are sent in
two cases:

1. before onboarding is complete
2. after onboarding is complete if either the basic functionality toggle
or the use phishing detection toggle is off

To ensure the first, a call to
`this.phishingController.maybeUpdateState()` in the metamask controller
constructor was moved to the `postOnboardingInitialization` function.

To ensure #2, two fixes were needed:
- prevent the aforementioned call from occury of the `usePhishDetect`
preference property is false
- have the `setUsePhishDetect` call that is made in `handleSubmit` of
`onboarding-flow/privacy-settings/privacy-settings.js` submit false if
the basic functionality toggle is off and the user has not independently
set the phishing detection toggle to on. This requires, in the advanced
section of the onboarding flow, to default the phishing detection toggle
setting to the basic functionality toggle value
(`externalServicesOnboardingToggleState`), but then only using the
phishing toggle value if the user sets that independently.

the `basic-functionality.spec.js` e2e tests were updated to ensure that
when the basic functionality toggle is off, no network request is sent
to the phishing endpoint, and that a request is sent when the toggle is
on.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25306?quickstart=1)

Fixes: MetaMask/MetaMask-planning#2625

1. Install and open the service worker (background) console, and open
the network tab
2. There should be no request to the phishing endpoint
3. Go through onboarding and toggle off the basic functionality toggle
in advanced settings, there should still be not network request to the
phishing endpoint
4. Uninstall and re-install and go through the above steps, but do not
toggle off the basic functionality toggle. There should now be a network
request to the phishing endpoint after the user completes onboarding.

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->

<!-- [screenshots/recordings] -->

- [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/develop/.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
- [ ] 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/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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.
@danjm danjm requested review from a team and kumavis as code owners June 14, 2024 17:09
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@danjm danjm changed the base branch from develop to Version-v11.16.11 June 14, 2024 17:10
@danjm danjm changed the title Cherry pick 743f5ec pr25306 Cherry pick 743f5ec pr25306 to v11.16.11 Jun 14, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 14, 2024
@danjm danjm merged commit a115615 into Version-v11.16.11 Jun 14, 2024
14 of 16 checks passed
@danjm danjm deleted the cherry-pick-743f5ec-PR25306 branch June 14, 2024 17:10
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants