Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix "activate Analytics" notification shown to view-only user without permission #12870

Description

@techanvil

Bug Description

A view-only user without permission to view Analytics module can see the "activate Analytics" notification on the dashboard.

This was raised in the bug bash, see this Asana task.

Steps to reproduce

  1. Set up Site Kit with the setupFlowRefresh feature flag enabled and Analytics connected.
  2. Share a module other than Analytics with a non-admin user.
  3. View the dashboard as that user.
  4. See the "activate Analytics" notification.

Screenshots

Image

Additional Context

  • PHP Version:
  • OS: any
  • Browser: any
  • Plugin Version: 1.180.0
  • Device: any

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The "activate Analytics" notification is not shown to a view-only user.

Implementation Brief

  • In assets/js/googlesitekit/notifications/register-defaults.js:
    • Update the checkRequirements for the activate-analytics-notification to include a permission check ensuring the user can view the Analytics module:
      • Add requireIsAuthenticated() to the requirement chain using asyncRequireAll().
      • This ensures the notification only displays to authenticated users or users with explicit permission to view the shared Analytics module.
      • The check should be placed after validating that Analytics is not active and before or after the requireCanActivateModule() check.

Test Coverage

  • Add test for checkRequirements to verify the notification is not active for view-only users without Analytics permission.

QA Brief

  • Follow the steps given in Steps to reproduce section above.
  • Ensure that the notification is not visible to view only user.

Changelog entry

  • Prevent the "activate Analytics" notification from appearing for view-only users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Next UpIssues to prioritize for definitionP0High priorityTeam MIssues for Squad 2Type: BugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions