-
Notifications
You must be signed in to change notification settings - Fork 333
Description
Bug Description
As per conversation with Mariya and Sigal on Slack here.
This issue combines #12246 and #12247 per @aaemnnosttv's suggestion, confirmed by Mariya.
Problem 1 (from #12246): When a user completes the setup of RRM and the organization/publication has a policy violation, the dashboard notification appears immediately after navigating away — even though the user just saw the setup success notification. As mentioned on this Slack conversation, this is too soon and frustrating.
Problem 2 (original #12247): For extreme violations, dismissing the dashboard notification currently results in permanent dismissal. Instead, it should reappear up to 5 times with a buffer between each appearance, before being permanently dismissed.
Solution: Per Evan's suggestion, we substitute "next login" with a 24-hour time-based buffer, which fits into the existing notification dismissal infrastructure. This applies to both problems.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Dashboard notifications should not appear immediately after setup (all severity levels):
- When the user sets up RRM with an organization or publication that has any level of policy violation, when they navigate away from the dashboard, they should not instantly see the dashboard notification upon returning to the dashboard.
- The dashboard notification should not reappear for 24 hours after the setup success notification is shown.
- This should apply to all policy violation severity levels (pending, active moderate/high, and extreme).
Extreme notifications should reappear up to 5 times:
- When the user sets up RRM with an organization/publication that has an extreme policy violation, they will be able to dismiss the dashboard notifications.
- Despite being dismissed, the notification will reappear after 24 hours, for up to 5 total dismissals. After the 5th dismissal, the notification should no longer appear on the dashboard.
Implementation Brief
-
Proactively dismiss dashboard notifications when the setup success notification renders with a policy violation — update
assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.tsx:- For moderate/high violations (
PENDING_POLICY_VIOLATION/ACTIVE_POLICY_VIOLATION):- call
registry.dispatch( CORE_USER ).dismissItem( RRM_POLICY_VIOLATION_MODERATE_HIGH_NOTIFICATION_ID, { expiresInSeconds: DAY_IN_SECONDS } ).
- call
- For extreme violations (
EXTREME_POLICY_VIOLATION, from #12245):- call
registry.dispatch( CORE_USER ).dismissItem( RRM_POLICY_VIOLATION_EXTREME_NOTIFICATION_ID, { expiresInSeconds: DAY_IN_SECONDS } ).
- call
- The existing
isShowingSuccessNotification()check incheckRequirementsalready prevents overlap while the setup page is active; the 24-hour dismissal covers the period after navigating away.
- For moderate/high violations (
-
Add
dismissRetries: 5to the extreme notification registration — updateassets/js/modules/reader-revenue-manager/index.js:- On the
RRM_POLICY_VIOLATION_EXTREME_NOTIFICATION_IDnotification config, adddismissRetries: 5. - This tells the notification system to use the prompts-based dismissal with 5 retries before permanent dismissal.
- On the
-
Update
dismissOptionsfor the extreme notification — updateassets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.tsx:- For the extreme case, change
dismissOptionsfrom{}(permanent,expiresInSeconds: 0) to{ expiresInSeconds: DAY_IN_SECONDS }(24-hour expiry). - Each dismissal suppresses the notification for 24 hours. After 5 total dismissals, the
dismissRetriesmechanism switches toexpiresInSeconds: 0(permanent), so the notification never appears again.
- For the extreme case, change
-
No Storybook changes needed — this is a behavioral change, not a visual change.
Test Coverage
- Add unit tests in
RRMSetupSuccessSubtleNotification/index.test.tsxto verify that when the setup success notification renders with a policy violation, the corresponding dashboard notification is proactively dismissed with a 24-hour expiry. - Add/update tests in
PolicyViolationNotification/index.test.tsxto verify the extreme notification is registered withdismissRetries: 5and uses a 24-hour expiry on dismissal.
QA Brief
- Turn on the
rrmPolicyViolationsfeature flag. - Set up Site Kit.
- Set up RRM with a publication that has an extreme policy violation.
- Upon seeing the setup success notification, dismiss it.
- Verify that you do not see the corresponding policy violation notification.
- Open the DB and look for
{prefix}_googlesitekitpersistent_dismissed_items(associated with your user ID) in the{prefix}_usermetatable. Change the expiry timestamp forrrm-policy-violation-extreme-notificationto the current (or a past) timestamp, so that our code thinks that 24 hours have passed since the notification was dismissed.
a. To get the current timestamp, go to unixtimestamp.com and simply click on the "Copy" button underneath the current timestamp. - Go back to the Site Kit dashboard and verify that you see the policy violation notification.
- Dismiss it.
- Similar to step 6, open the DB and look for
{prefix}_googlesitekitpersistent_dismissed_prompts(associated with your user ID) in the{prefix}_usermetatable. Change the expiry timestamp forrrm-policy-violation-extreme-notificationto the current (or a past) timestamp, so that our code thinks that 24 hours have passed since the notification was dismissed.
a. You do NOT need to increment its count. It will be incremented automatically when the notification is dismissed. - Go back to the Site Kit dashboard and verify that you see the policy violation notification again.
- Repeat steps 9-10 for 5 dismissals. After dismissing it for 5 times, the expiry timestamp in the DB should automatically change to 0 (permanent dismissal) and you no longer should see the policy violation notification.
Changelog entry
- Improve dismissal behavior for RRM policy violation notifications by delaying them for 24 hours after setup and allowing extreme notifications to reappear up to 5 times before permanent dismissal.