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

fix (cherry-pick for v12.0.0): add unlock checks for notification related controllers #26194

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Jul 29, 2024

Description

This is a cherry pick for #26189 (2197d29)

Ensures that we correctly call the preinstalled snap when the wallet is unlocked. Also prevents unlock confirmations being created due to snap calls when wallet is locked

Open in GitHub Codespaces

Related issues

Ticket

Fixes: #26064

Manual testing steps

  1. Install the extension > go through onboarding > enable notifications
  2. Restart browser or refresh the chrome extension
  3. You should not see the unlock window pop up immediately and also stops the confirmation counter on the badge from continuously increasing due to preinstalled snap invokations.

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

)

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

Ensures that we correctly call the preinstalled snap when the wallet is
unlocked. Also prevents unlock confirmations being created due to snap
calls when wallet is locked

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

[Ticket](https://consensyssoftware.atlassian.net/browse/NOTIFY-865)

Fixes: #26064

1. Install the extension and enable notifications
2. Restart the browser, or reload the extension
3. Should see no auto opening of the wallet, and no unlock confirmations
being made.

<!-- 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
- [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/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.
@Prithpal-Sooriya Prithpal-Sooriya added team-notifications Notifications team release-12.0.0 Issue or pull request that will be included in release 12.0.0 labels Jul 29, 2024
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners July 29, 2024 16:47
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.

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 74.41860% with 11 lines in your changes missing coverage. Please review.

Project coverage is 65.59%. Comparing base (6180c91) to head (309132e).

Files Patch % Lines
...s/metamask-notifications/metamask-notifications.ts 70.59% 5 Missing ⚠️
...ollers/authentication/authentication-controller.ts 71.43% 4 Missing ⚠️
...ontrollers/user-storage/user-storage-controller.ts 83.33% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           Version-v12.0.0   #26194      +/-   ##
===================================================
+ Coverage            65.58%   65.59%   +0.02%     
===================================================
  Files                 1368     1368              
  Lines                54566    54603      +37     
  Branches             14186    14180       -6     
===================================================
+ Hits                 35783    35816      +33     
- Misses               18783    18787       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [309132e]
Page Load Metrics (120 ± 150 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint71190872512
domContentLoaded8211031
load411479120312150
domInteractive8211031

@chloeYue
Copy link
Contributor

hi @Prithpal-Sooriya , i don't see these 2 lines in this cherry-pick PR, is it intended?

export type Events =
  | MetamaskNotificationsControllerNotificationsListUpdatedEvent
  | MetamaskNotificationsControllerMarkNotificationsAsRead;

https://github.com/MetaMask/metamask-extension/pull/26189/files#diff-06756f69e37f2232f17817021fec595c4a1477c7ab9dc5ce90945c34801c00e0R216

@Prithpal-Sooriya
Copy link
Contributor Author

Hey @chloeYue, yes these are recent changes only available in v12.0.1+, not in v12.0.0

@chloeYue chloeYue merged commit 3da911e into Version-v12.0.0 Jul 30, 2024
80 checks passed
@chloeYue chloeYue deleted the cherry-pick-v12.0.0-2197d295ec646f4637b8ea0fd766da08b5e7c17e branch July 30, 2024 08:49
@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.0.0 Issue or pull request that will be included in release 12.0.0 team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants