-
Notifications
You must be signed in to change notification settings - Fork 333
Description
Feature Description
Update the SetupUsingProxyViewOnly component (and related admin view-only sign-in flow) to support a redirect_url query parameter. When present, clicking "Go to dashboard" redirects to the dashboard URL with the original query params preserved. This enables email reporting links to be proxied through the splash screen while still opening the email reporting panel automatically after the user proceeds.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
notificationandpanelquery parameters are persisted through all splash screen and authentication flows.- When a user arrives at the dashboard with
notification=X, the corresponding notification is displayed. - When a user arrives at the dashboard with
panel=email-reporting, the email reporting panel opens. - Without these parameters, all existing behaviour is unchanged.
Implementation Brief
Migrate email-reporting-panel to panel=email-reporting
The existing email-reporting-panel=1 query parameter is replaced with the more general panel=email-reporting. This allows the panel parameter to open different panels (one at a time) without requiring feature-specific query keys.
-
Update file
includes/Core/Email_Reporting/Email_Reporting.php:- Change
register_link( 'manage-subscription', array( 'email-reporting-panel' => 1 ) )toarray( 'panel' => 'email-reporting' ) - Change
register_link( 'unsubscribe', array( 'email-reporting-panel' => 1 ) )toarray( 'panel' => 'email-reporting' )
- Change
-
Update file
includes/Core/Email_Reporting/Email_Reporting_Pointer.php:- Change
admin_url( 'dashboard', array( 'email-reporting-panel' => 1 ) )toarray( 'panel' => 'email-reporting' )
- Change
-
Update file
assets/js/hooks/useOpenEmailReportingSelectionPanelEffect.js:- Read the
panelquery arg instead ofemail-reporting-panel - Open the email reporting selection panel when
panel === 'email-reporting'(instead of checking for presence ofemail-reporting-panel)
- Read the
Backend (PHP) - splash param preservation
- Update file
includes/Core/Admin/Screens.php:no_access_redirect_dashboard_to_splash()(line ~285):- Read
notificationandpanelfrom$this->context->input()->filter( INPUT_GET, ... )(do not read from$_GETdirectly) - Pass them as query args to
$this->context->admin_url( 'splash', [ 'notification' => ..., 'panel' => ... ] ) - This preserves supported params when any user without dashboard access is redirected to the splash
- Read
- Splash
initialize_callback(line ~516):- Pass
panelthrough alongside the existingnotificationpass-through so both params survive the splash → dashboard redirect for users who already have access
- Pass
Frontend (JavaScript) - splash param preservation
-
Create file
assets/js/util/getForwardableParams.js:- Export a function that reads
notificationandpanelfromglobal.location.hrefusinggetQueryArgand returns an object with the non-empty values - This avoids duplicating the param extraction logic across multiple components
- Export a function that reads
-
Update file
assets/js/components/setup/SetupUsingProxyViewOnly.js:- Import the new utility
- Use the utility to get forwardable params and pass them to
getAdminURL( 'googlesitekit-dashboard', { ...params } )for the "Go to dashboard" navigation
-
Update file
assets/js/components/setup/SetupUsingProxyWithSignIn/Actions.js:- Import the new utility
- Use the utility to get forwardable params and pass them to
getAdminURLfor the "Skip sign-in" navigation
-
Update file
assets/js/components/setup/SetupUsingProxyWithSignIn/index.js:- Import the new utility
- Use the utility to get forwardable params and build a post-auth dashboard URL via
getAdminURL( 'googlesitekit-dashboard', { ...params } ) - In
onButtonClick, pass this URL asredirecttoproxySetupURLso the params survive the OAuth round-trip via the existingredirect>OPTION_REDIRECT_URL>OAuth_Client::get_authorize_user_redirect_url()mechanism moduleReauthURLbranch remains first (takes priority)
Test Coverage
-
Jest tests in
assets/js/components/setup/SetupUsingProxyViewOnly.test.js(new file):- "Go to dashboard" navigates to base dashboard URL when no params are present
- "Go to dashboard" navigates to dashboard with
panel=email-reportingwhen present in splash URL - "Go to dashboard" navigates to dashboard with
notification=Xwhen present in splash URL
-
Jest tests in
assets/js/components/setup/SetupUsingProxyWithSignIn/Actions.test.js(update existing):- "Skip sign-in" with
panelparam navigates to dashboard with param preserved - "Skip sign-in" without params navigates to base dashboard
- "Skip sign-in" with
-
Jest tests in
assets/js/components/setup/SetupUsingProxyWithSignIn/index.test.js(update existing):- "Sign in with Google" with
panelparam passes dashboard URL with param asredirectto proxy setup URL - "Sign in with Google" without params navigates to bare proxy setup URL
- "Sign in with Google" with
QA Brief
Site Kit should not have been setup, for each test it should be blank installation with splash screen only visible. Ensure proactiveEngagement feature flag is enabled (for seeing the email reporting panel, but URL params should still be preserved in URL regardless of feature flag)
Email reporting panel/param
- Admin test
- Add this path to the base website URL:
/wp-admin/admin.php?page=googlesitekit-dashboard&panel=email-reportingAnd/wp-admin/admin.php?page=googlesitekit-splash&panel=email-reportingboth should land on splash screen - Setup Site Kit, and verify that after successful OAuth when redirected back to SK dashboard - email reporting side panel is opened
- Add this path to the base website URL:
- View only users
- Use the same path as above, you should land on dashboard with email reporting side panel opened
- Secondary Admins
- Paste same URL as before, after landing on splash screen, whether you authenticate the admin or choose skip sign in and view limited dashbaord, when landing on dashboard - email reporting side panel should open
Notification parameter
- Repeat steps above, only use this path
/wp-admin/admin.php?page=googlesitekit-splash¬ification=test_notice - Verify that when redirected to the dashboard, the
otification=test_noticeURL param is preserved
With SK being setup
- Setup SK with
proactiveEngagementfeature flag enabled - Include this path:
/wp-admin/admin.php?page=googlesitekit-dashboard&panel=email-reporting- Verify it lands on SK dashboard and opens email reporting panel
- Go to WP dashboard - when email reporting pointer shows, click on
SetupCTA, verify it still correctly redirects you to the dashboard with email reporting panel opened
Changelog entry
- Ensure query params persist during email subscription flow.