Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Social: enable the modernized wp-admin dashboard for all sites by default.
6 changes: 5 additions & 1 deletion projects/packages/publicize/src/class-social-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,14 @@ public static function alias_screen_id_for_wp_build( $screen ) {
/**
* Returns true when the wp-build modernization filter is enabled.
*
* The modernized Social dashboard now defaults on for every site. Hosts (and
* a11ns who want the legacy view back) can still force the legacy experience
* with `add_filter( self::MODERNIZATION_FILTER, '__return_false' );`.
*
* @return bool
*/
private static function is_modernized() {
return (bool) apply_filters( self::MODERNIZATION_FILTER, false );
return (bool) apply_filters( self::MODERNIZATION_FILTER, true );
}

/**
Expand Down
18 changes: 11 additions & 7 deletions projects/packages/publicize/tests/php/Social_Admin_Page_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,22 @@ public function test_admin_init_refreshes_plan_with_valid_nonce() {
}

/**
* When modernization is OFF, the legacy admin script is enqueued.
* Modernization now defaults ON, so with the wp-build chassis available and no
* filter overriding the default, the legacy admin script is NOT enqueued — the
* wp-build dashboard owns the page.
*/
public function test_enqueue_loads_legacy_script_when_not_modernized() {
public function test_enqueue_skips_legacy_script_by_default() {
// Define the wp-build render fn in the GLOBAL namespace (via fixture) so
// is_wp_build_dashboard_active()'s function_exists() check passes. No
// modernization filter is set, so this exercises the new default-on behavior.
require_once __DIR__ . '/fixtures/wp-build-render-fn.php';

Social_Admin_Page::init()->enqueue_admin_scripts();

$this->assertTrue(
$this->assertFalse(
wp_script_is( 'social-admin-page', 'enqueued' ),
'Legacy Social admin script should be enqueued when modernization is off.'
'Legacy script should not be enqueued by default now that modernization is on.'
);

wp_dequeue_script( 'social-admin-page' );
wp_deregister_script( 'social-admin-page' );
}

/**
Expand Down
3 changes: 3 additions & 0 deletions projects/plugins/social/changelog/release-social-dashboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Significance: patch
Type: changed
Comment: Update the e2e connection test to assert on the modernized Social dashboard UI.
9 changes: 7 additions & 2 deletions projects/plugins/social/tests/e2e/specs/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ test( 'Jetpack Social connection', async ( { page, admin, requestUtils } ) => {
} );

await test.step( 'Verify connection in Jetpack Social page', async () => {
await expect( page.getByRole( 'button', { name: 'Connect accounts' } ) ).toBeVisible();
await expect( page.getByRole( 'button', { name: 'Write a post' } ) ).toBeVisible();
// The modernized dashboard lands on the Overview tab with no social
// accounts connected yet, so assert on its empty state and the
// "Add account" header CTA (rendered twice — header + empty state).
await expect(
page.getByRole( 'heading', { name: 'No accounts connected yet' } )
).toBeVisible();
await expect( page.getByRole( 'button', { name: 'Add account' } ).first() ).toBeVisible();
} );
} );
Loading