Repository navigation
feat(notification-services-controller): enforce marketing consent on notification preferences - #10861
Draft
zelkibuilds wants to merge 4 commits into
Draft
zelkibuilds wants to merge 4 commits into
zelkibuilds wants to merge 4 commits into
Conversation
…notification preferences - Add updateNotificationPreferences, which saves a partial update merged over a fresh read, one update at a time, and rejects an update that turns a marketing channel on without marketing consent (MarketingConsentRequiredError). - Seed both marketing channels from AnalyticsController consent when preferences are created for the first time. - Deprecate isFeatureAnnouncementsEnabled, setFeatureAnnouncementsEnabled and the hasMarketingConsent/productAnnouncementEnabled options. - Move ownership to team-engagement.
3 of 4 tasks
zelkibuilds
added this pull request to stack #10860
October 16, 2026 10:53
…consent-notification-services
Contributor
Author
|
@metamaskbot publish-previews |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…consent-notification-services
zelkibuilds
marked this pull request as ready for review
October 16, 2026 14:27
zelkibuilds
marked this pull request as draft
October 16, 2026 14:28
…d updates finish Re-reading after every update published in-between states to UIs bound to the AUS cache, so a toggle still queued briefly flipped back. Re-read once the queue drains, and only if an update was written. Start a section missing from stored preferences from its defaults.
Contributor
Author
|
@metamaskbot publish-previews |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
4 of 10 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Marketing notifications rely on marketing consent. #10821 turns them off when consent goes off; this PR covers the other direction in
@metamask/notification-services-controller: a marketing notification can't be turned on without consent, and new users don't start with marketing notifications on unless they consented.updateNotificationPreferences(new method and messenger action):NotificationPreferencesUpdate). Fields left out keep their stored value; arrays and maps are replaced whole.MarketingConsentRequiredError(match onMARKETING_CONSENT_REQUIRED_ERROR_CODE). A marketing notification already on in AUS doesn't block other updates.AnalyticsControllermarketing consent.isFeatureAnnouncementsEnabled,setFeatureAnnouncementsEnabled, and thehasMarketingConsentandproductAnnouncementEnabledoptions, all replaced by marketing consent.team-engagementinteams.json.Client impact
AnalyticsController:getStateandAuthenticatedUserStorageService:invalidateQueries.updateNotificationPreferences, sending only what changed. Reads stay onAuthenticatedUserStorageService:getNotificationPreferences.Follow-ups
PerpsControllerwrites whole preferences to AUS from a possibly stale copy. Route its two watchlist writes (#persistWatchlistToRemote,#syncWatchlistFromRemote) throughNotificationServicesController:updateNotificationPreferencesas{ perps: { watchlistMarkets } }, then removeAuthenticatedUserStorageService:putNotificationPreferencesfrom the Perps messenger in both clients. Needs the Perps team.References
@metamask/marketing-consent-controllerand marketing consent check in NSC #10821.Checklist
Note
High Risk
Breaking messenger wiring and first-time marketing/feature-announcement defaults affect all clients; preference writes now gate marketing channels on consent and change how stale AUS data is handled.
Overview
Adds
updateNotificationPreferences(and the matching messenger action) as the supported write path for Authenticated User Storage notification prefs: partial updates merge over a fresh read, updates are serialized, the AUS preferences cache is invalidated/refreshed, and turning marketing push or in-app channels on without consent throwsMarketingConsentRequiredError.Breaking: the NSC messenger must allow
AnalyticsController:getStateandAuthenticatedUserStorageService:invalidateQueries. On first-time preference creation, both marketing channels are seeded from analytics marketing consent;hasMarketingConsent/productAnnouncementEnabledare ignored (users without consent no longer default to feature announcements on).Deprecates
isFeatureAnnouncementsEnabled,setFeatureAnnouncementsEnabled, and those enable options in favor of AUSmarketing.inAppNotificationsEnabled. Adds@metamask/analytics-controllerand moves package ownership to team-engagement.Reviewed by Cursor Bugbot for commit c54f779. Bugbot is set up for automated code reviews on this repo. Configure here.