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: Avoid to send the snap notification id to the notifications server #25099

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

matteoscurati
Copy link
Contributor

@matteoscurati matteoscurati commented Jun 6, 2024

Description

This PR fixes a bug related to the "Mark all notifications as read" button. The button is responsible, when clicked, for performing the actions to mark a notification as read. In the case of on-chain notifications, this state needs to be saved via API on the notification server. The PR prevents the IDs of SNAP notifications from being sent to the server, as their read/unread state is managed differently.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). 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.

@matteoscurati matteoscurati added the team-notifications Notifications team label Jun 6, 2024
@matteoscurati matteoscurati marked this pull request as ready for review June 6, 2024 13:12
@matteoscurati matteoscurati requested a review from a team as a code owner June 6, 2024 13:12
Copy link
Contributor

github-actions bot commented Jun 6, 2024

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.

useState<MarkAsReadNotificationsParam>([]);

useEffect(() => {
const handleOnClick = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, we did not need an effect! ❤️

trackEvent({
category: MetaMetricsEventCategory.NotificationInteraction,
event: MetaMetricsEventName.MarkAllNotificationsRead,
});

// Mark all metamask notifications as read
markNotificationAsRead(notificationReadArray);
markNotificationAsRead(notificationsRead);
Copy link
Contributor

Choose a reason for hiding this comment

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

I got really confused since we were filtering out snap notifications.

But yes this method (as the comment above mentions) is only for wallet notifications, so we can filter out these notifications.

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 65.65%. Comparing base (55f1a8e) to head (b8622ca).
Report is 149 commits behind head on develop.

Files Patch % Lines
...tifications/notifications-list-read-all-button.tsx 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25099      +/-   ##
===========================================
- Coverage    65.66%   65.65%   -0.01%     
===========================================
  Files         1359     1359              
  Lines        54014    54012       -2     
  Branches     14015    14017       +2     
===========================================
- Hits         35464    35459       -5     
- Misses       18550    18553       +3     

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

@metamaskbot
Copy link
Collaborator

Builds ready [b8622ca]
Page Load Metrics (47 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint62947984
domContentLoaded9151021
load41634773
domInteractive9151021
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 73 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matteoscurati matteoscurati merged commit 7eaf6b7 into develop Jun 7, 2024
77 checks passed
@matteoscurati matteoscurati deleted the fix/mark-all-as-read-button branch June 7, 2024 14:34
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants