Connectors: Hide Akismet unless already installed#76962
Conversation
Skip registering the Akismet connector on the connectors screen when its plugin is not installed on the site.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 7.73 MB ℹ️ View Unchanged
|
Remove the dedicated Akismet visibility test and exclude Akismet from the CONNECTORS array since it no longer appears on the connectors screen when not installed.
c5363b0 to
7259bcc
Compare
gziolo
left a comment
There was a problem hiding this comment.
That's an interesting side-effect with tests when Akismet is not included in the plugins directory. However, technically this is expected and confirm this works as intended.
| const sanitize = ( s: string ) => s.replace( /[^a-z0-9-_]/gi, '-' ); | ||
|
|
||
| for ( const [ connectorId, data ] of Object.entries( connectors ) ) { | ||
| // Hide Akismet unless it is already installed. |
There was a problem hiding this comment.
Maybe, mark it as a special case and reference the Core Trac ticket for documentation purposes.
Reference https://core.trac.wordpress.org/ticket/65012 for context on why Akismet is hidden when not installed.
|
Flaky tests detected in bc80585. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23858476622
|
Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: gziolo <[email protected]>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: e116f89 |
Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: gziolo <[email protected]>
This reverts commit f0bbfd6.
Gutenberg changelog: - Style Book: Fix missing styles for classic themes in stylebook route (WordPress/gutenberg#76843) - RTC: Fix stuck "Join" link in post list when lock expires (WordPress/gutenberg#76795) - Icon: Fix center alignment in the editor for classic themes (WordPress/gutenberg#76878) - RTC: Fix notes not syncing between collaborative editors (WordPress/gutenberg#76873) - Latest Comments: Fix v1 deprecated block missing supports (WordPress/gutenberg#76877) - Connectors: Add Akismet as a default connector (WordPress/gutenberg#76828) - Restore with compaction update (WordPress/gutenberg#76872) - Improve JSDoc for abilities API (WordPress/gutenberg#76824) - Connectors: Replace plugin.slug with plugin.file (WordPress/gutenberg#76909) - Block visibility badge: use canvas iframe for viewport detection (WordPress/gutenberg#76889) - Connectors: Update help text from 'reset' to 'manage' (WordPress/gutenberg#76963) - Connectors: Hide Akismet unless already installed (WordPress/gutenberg#76962) - Wrap sync update processing in try/catch (WordPress/gutenberg#76968) - Backport: Improve validation and permission checks for `WP_HTTP_Polling_Sync_Server` (WordPress/gutenberg#76987) - Connectors: account for mu-plugins when resolving plugin.file status (WordPress/gutenberg#76994)
This updates the pinned hash from the `gutenberg` from `0d133bf7e7437d65d68a06551f3d613a7d8e4361` to `e2970ba736edb99e08fb369d4fb0c378189468ee`. The following changes are included: - WordPress/gutenberg#76478 Boot: Fix black area below content when sidebar is taller than page c… (WordPress/gutenberg#76764) - Style Book: Fix missing styles for classic themes in stylebook route (WordPress/gutenberg#76843) - RTC: Fix stuck "Join" link in post list when lock expires (WordPress/gutenberg#76795) - Icon: Fix center alignment in the editor for classic themes (WordPress/gutenberg#76878) - RTC: Fix notes not syncing between collaborative editors (WordPress/gutenberg#76873) - Latest Comments: Fix v1 deprecated block missing supports (WordPress/gutenberg#76877) - Connectors: Add Akismet as a default connector (WordPress/gutenberg#76828) - Restore with compaction update (WordPress/gutenberg#76872) - Improve JSDoc for abilities API (WordPress/gutenberg#76824) - Connectors: Replace plugin.slug with plugin.file (WordPress/gutenberg#76909) - Block visibility badge: use canvas iframe for viewport detection (WordPress/gutenberg#76889) - Connectors: Update help text from 'reset' to 'manage' (WordPress/gutenberg#76963) - Connectors: Hide Akismet unless already installed (WordPress/gutenberg#76962) - Wrap sync update processing in try/catch (WordPress/gutenberg#76968) - Backport: Improve validation and permission checks for `WP_HTTP_Polling_Sync_Server` (WordPress/gutenberg#76987) - Connectors: account for mu-plugins when resolving plugin.file status (WordPress/gutenberg#76994) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/0d133bf7e7437d65d68a06551f3d613a7d8e4361…e2970ba736edb99e08fb369d4fb0c378189468ee. Log created with: git log --reverse --format="- %s" 0d133bf7e7437d65d68a06551f3d613a7d8e4361..e2970ba736edb99e08fb369d4fb0c378189468ee | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/trunk@62209 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `0d133bf7e7437d65d68a06551f3d613a7d8e4361` to `e2970ba736edb99e08fb369d4fb0c378189468ee`. The following changes are included: - WordPress/gutenberg#76478 Boot: Fix black area below content when sidebar is taller than page c… (WordPress/gutenberg#76764) - Style Book: Fix missing styles for classic themes in stylebook route (WordPress/gutenberg#76843) - RTC: Fix stuck "Join" link in post list when lock expires (WordPress/gutenberg#76795) - Icon: Fix center alignment in the editor for classic themes (WordPress/gutenberg#76878) - RTC: Fix notes not syncing between collaborative editors (WordPress/gutenberg#76873) - Latest Comments: Fix v1 deprecated block missing supports (WordPress/gutenberg#76877) - Connectors: Add Akismet as a default connector (WordPress/gutenberg#76828) - Restore with compaction update (WordPress/gutenberg#76872) - Improve JSDoc for abilities API (WordPress/gutenberg#76824) - Connectors: Replace plugin.slug with plugin.file (WordPress/gutenberg#76909) - Block visibility badge: use canvas iframe for viewport detection (WordPress/gutenberg#76889) - Connectors: Update help text from 'reset' to 'manage' (WordPress/gutenberg#76963) - Connectors: Hide Akismet unless already installed (WordPress/gutenberg#76962) - Wrap sync update processing in try/catch (WordPress/gutenberg#76968) - Backport: Improve validation and permission checks for `WP_HTTP_Polling_Sync_Server` (WordPress/gutenberg#76987) - Connectors: account for mu-plugins when resolving plugin.file status (WordPress/gutenberg#76994) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/0d133bf7e7437d65d68a06551f3d613a7d8e4361…e2970ba736edb99e08fb369d4fb0c378189468ee. Log created with: git log --reverse --format="- %s" 0d133bf7e7437d65d68a06551f3d613a7d8e4361..e2970ba736edb99e08fb369d4fb0c378189468ee | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/trunk@62209 git-svn-id: http://core.svn.wordpress.org/trunk@61489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the pinned hash from the `gutenberg` from `0d133bf7e7437d65d68a06551f3d613a7d8e4361` to `e2970ba736edb99e08fb369d4fb0c378189468ee`. The following changes are included: - WordPress/gutenberg#76478 Boot: Fix black area below content when sidebar is taller than page c… (WordPress/gutenberg#76764) - Style Book: Fix missing styles for classic themes in stylebook route (WordPress/gutenberg#76843) - RTC: Fix stuck "Join" link in post list when lock expires (WordPress/gutenberg#76795) - Icon: Fix center alignment in the editor for classic themes (WordPress/gutenberg#76878) - RTC: Fix notes not syncing between collaborative editors (WordPress/gutenberg#76873) - Latest Comments: Fix v1 deprecated block missing supports (WordPress/gutenberg#76877) - Connectors: Add Akismet as a default connector (WordPress/gutenberg#76828) - Restore with compaction update (WordPress/gutenberg#76872) - Improve JSDoc for abilities API (WordPress/gutenberg#76824) - Connectors: Replace plugin.slug with plugin.file (WordPress/gutenberg#76909) - Block visibility badge: use canvas iframe for viewport detection (WordPress/gutenberg#76889) - Connectors: Update help text from 'reset' to 'manage' (WordPress/gutenberg#76963) - Connectors: Hide Akismet unless already installed (WordPress/gutenberg#76962) - Wrap sync update processing in try/catch (WordPress/gutenberg#76968) - Backport: Improve validation and permission checks for `WP_HTTP_Polling_Sync_Server` (WordPress/gutenberg#76987) - Connectors: account for mu-plugins when resolving plugin.file status (WordPress/gutenberg#76994) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/0d133bf7e7437d65d68a06551f3d613a7d8e4361…e2970ba736edb99e08fb369d4fb0c378189468ee. Log created with: git log --reverse --format="- %s" 0d133bf7e7437d65d68a06551f3d613a7d8e4361..e2970ba736edb99e08fb369d4fb0c378189468ee | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/branches/7.0@62212 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `0d133bf7e7437d65d68a06551f3d613a7d8e4361` to `e2970ba736edb99e08fb369d4fb0c378189468ee`. The following changes are included: - WordPress/gutenberg#76478 Boot: Fix black area below content when sidebar is taller than page c… (WordPress/gutenberg#76764) - Style Book: Fix missing styles for classic themes in stylebook route (WordPress/gutenberg#76843) - RTC: Fix stuck "Join" link in post list when lock expires (WordPress/gutenberg#76795) - Icon: Fix center alignment in the editor for classic themes (WordPress/gutenberg#76878) - RTC: Fix notes not syncing between collaborative editors (WordPress/gutenberg#76873) - Latest Comments: Fix v1 deprecated block missing supports (WordPress/gutenberg#76877) - Connectors: Add Akismet as a default connector (WordPress/gutenberg#76828) - Restore with compaction update (WordPress/gutenberg#76872) - Improve JSDoc for abilities API (WordPress/gutenberg#76824) - Connectors: Replace plugin.slug with plugin.file (WordPress/gutenberg#76909) - Block visibility badge: use canvas iframe for viewport detection (WordPress/gutenberg#76889) - Connectors: Update help text from 'reset' to 'manage' (WordPress/gutenberg#76963) - Connectors: Hide Akismet unless already installed (WordPress/gutenberg#76962) - Wrap sync update processing in try/catch (WordPress/gutenberg#76968) - Backport: Improve validation and permission checks for `WP_HTTP_Polling_Sync_Server` (WordPress/gutenberg#76987) - Connectors: account for mu-plugins when resolving plugin.file status (WordPress/gutenberg#76994) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/0d133bf7e7437d65d68a06551f3d613a7d8e4361…e2970ba736edb99e08fb369d4fb0c378189468ee. Log created with: git log --reverse --format="- %s" 0d133bf7e7437d65d68a06551f3d613a7d8e4361..e2970ba736edb99e08fb369d4fb0c378189468ee | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/branches/7.0@62212 git-svn-id: http://core.svn.wordpress.org/branches/7.0@61492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: gziolo <[email protected]>
Re-adds the test that was removed when Akismet was hidden client-side in #76962. Now that the server reports Akismet's install status correctly and the JS hide logic is gone, the screen should render the Akismet card with an Install button when the plugin is not installed — make sure that's covered.
…7897) * Connectors: Add is_active callback support to plugin registration Backports the WP Core changes from WordPress/wordpress-develop#11565 so that AI provider connectors (and Akismet) report the correct plugin status. Without an explicit `is_active` callback the registry's new `__return_true` default made every pre-registered connector appear active even when the underlying plugin was not installed, so the Connectors screen showed a "Set up" button instead of "Install" whenever Gutenberg was active. - Mirror the registry's `__return_true` default and the simplified is_installed/is_activated derivation in the script module data. - Wire AI providers to `$ai_registry->hasProvider( $id )` so their status reflects whether the provider plugin is actually available. - Set Akismet's `is_active` to `is_plugin_active( 'akismet/akismet.php' )` since Gutenberg pre-registers it (Core does not), and the new default would otherwise mark it as always installed. * Connectors: Show Akismet with Install button when not installed The previous client-side workaround hid Akismet entirely whenever the plugin was not installed, because the server could not report Akismet's install status reliably. With the new `is_active` callback wired up on the server side, `isInstalled` is now accurate, so Akismet can be rendered like any other default connector and offer an Install button when the plugin is missing. * Connectors: Restore E2E coverage for Akismet Install button Re-adds the test that was removed when Akismet was hidden client-side in #76962. Now that the server reports Akismet's install status correctly and the JS hide logic is gone, the screen should render the Akismet card with an Install button when the plugin is not installed — make sure that's covered. * Connectors: Update E2E test to expect Install button label * Connectors: Drop default is_active fallback in registry All pre-registered connectors now supply their own `is_active` callback, so the `__return_true` default is no longer needed. Removing it aligns the registry with the upstream WP Core PR and avoids silently masking connectors that forget to declare an `is_active` callback. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Guard against missing is_active in script module data Now that the registry no longer injects a default `__return_true` for `is_active`, a connector registered with a `plugin.file` but without an `is_active` callback would trigger an undefined-index warning. Treat that case as active on the assumption the plugin only registers the connector when it is loaded. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Detect Akismet via AKISMET_VERSION constant Switch the Akismet `is_active` callback from `is_plugin_active()` to a `defined( 'AKISMET_VERSION' )` check so it does not have to load `wp-admin/includes/plugin.php`. This keeps the callback safe to invoke in non-admin requests where pulling in the admin plugin helpers would be unnecessary overhead. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ADd backport changelog * Connectors: Remove outdated is_active default from docblock The default `__return_true` fallback was dropped from the registry, but the docblock still advertised it. Remove the stale line so callers do not assume a default exists. * Connectors: Restore Akismet hide-when-not-installed special case Bring back the JS-side guard that hides Akismet when the plugin is not installed. Akismet is bundled with WordPress and the product decision is to keep it out of the connectors list when missing — other connectors remain visible because plugins like Woo or SEO suites benefit from the auto-install/activate flow for their own third-party integrations. Also drop the E2E test that asserted the inverse (Install button visible for Akismet), since it conflicts with the restored behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Document default is_active behavior in docblock When the is_active callback is omitted and a file is provided, the connector is treated as active under the assumption that the plugin must be loaded in order to register itself. Spell that out so callers do not mistake the omission for a no-op. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Use validate_plugin() to detect installed plugin file Switch the install probe from a raw file_exists() to validate_plugin(), which adds path traversal protection and confirms the file is a recognised plugin (not just any file at that path). Restores the require_once for wp-admin/includes/plugin.php that this function needs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Default plugin is_active to __return_true Align with WordPress core, which sets is_active to '__return_true' when omitted at registration. This lets the rendering site call is_active unconditionally instead of branching on whether it was provided. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Align phpstan type with stored connector shape After the registry now always initializes `plugin` and defaults `is_active` to `__return_true`, mark `plugin` as required and `file` as optional in the @phpstan-type so static analysis matches what `register()` actually returns. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: t-hamano <[email protected]> Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: mukeshpanchal27 <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: westonruter <[email protected]>
…7897) * Connectors: Add is_active callback support to plugin registration Backports the WP Core changes from WordPress/wordpress-develop#11565 so that AI provider connectors (and Akismet) report the correct plugin status. Without an explicit `is_active` callback the registry's new `__return_true` default made every pre-registered connector appear active even when the underlying plugin was not installed, so the Connectors screen showed a "Set up" button instead of "Install" whenever Gutenberg was active. - Mirror the registry's `__return_true` default and the simplified is_installed/is_activated derivation in the script module data. - Wire AI providers to `$ai_registry->hasProvider( $id )` so their status reflects whether the provider plugin is actually available. - Set Akismet's `is_active` to `is_plugin_active( 'akismet/akismet.php' )` since Gutenberg pre-registers it (Core does not), and the new default would otherwise mark it as always installed. * Connectors: Show Akismet with Install button when not installed The previous client-side workaround hid Akismet entirely whenever the plugin was not installed, because the server could not report Akismet's install status reliably. With the new `is_active` callback wired up on the server side, `isInstalled` is now accurate, so Akismet can be rendered like any other default connector and offer an Install button when the plugin is missing. * Connectors: Restore E2E coverage for Akismet Install button Re-adds the test that was removed when Akismet was hidden client-side in #76962. Now that the server reports Akismet's install status correctly and the JS hide logic is gone, the screen should render the Akismet card with an Install button when the plugin is not installed — make sure that's covered. * Connectors: Update E2E test to expect Install button label * Connectors: Drop default is_active fallback in registry All pre-registered connectors now supply their own `is_active` callback, so the `__return_true` default is no longer needed. Removing it aligns the registry with the upstream WP Core PR and avoids silently masking connectors that forget to declare an `is_active` callback. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Guard against missing is_active in script module data Now that the registry no longer injects a default `__return_true` for `is_active`, a connector registered with a `plugin.file` but without an `is_active` callback would trigger an undefined-index warning. Treat that case as active on the assumption the plugin only registers the connector when it is loaded. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Detect Akismet via AKISMET_VERSION constant Switch the Akismet `is_active` callback from `is_plugin_active()` to a `defined( 'AKISMET_VERSION' )` check so it does not have to load `wp-admin/includes/plugin.php`. This keeps the callback safe to invoke in non-admin requests where pulling in the admin plugin helpers would be unnecessary overhead. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ADd backport changelog * Connectors: Remove outdated is_active default from docblock The default `__return_true` fallback was dropped from the registry, but the docblock still advertised it. Remove the stale line so callers do not assume a default exists. * Connectors: Restore Akismet hide-when-not-installed special case Bring back the JS-side guard that hides Akismet when the plugin is not installed. Akismet is bundled with WordPress and the product decision is to keep it out of the connectors list when missing — other connectors remain visible because plugins like Woo or SEO suites benefit from the auto-install/activate flow for their own third-party integrations. Also drop the E2E test that asserted the inverse (Install button visible for Akismet), since it conflicts with the restored behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Document default is_active behavior in docblock When the is_active callback is omitted and a file is provided, the connector is treated as active under the assumption that the plugin must be loaded in order to register itself. Spell that out so callers do not mistake the omission for a no-op. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Use validate_plugin() to detect installed plugin file Switch the install probe from a raw file_exists() to validate_plugin(), which adds path traversal protection and confirms the file is a recognised plugin (not just any file at that path). Restores the require_once for wp-admin/includes/plugin.php that this function needs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Default plugin is_active to __return_true Align with WordPress core, which sets is_active to '__return_true' when omitted at registration. This lets the rendering site call is_active unconditionally instead of branching on whether it was provided. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Connectors: Align phpstan type with stored connector shape After the registry now always initializes `plugin` and defaults `is_active` to `__return_true`, mark `plugin` as required and `file` as optional in the @phpstan-type so static analysis matches what `register()` actually returns. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: t-hamano <[email protected]> Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: mukeshpanchal27 <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]> Co-authored-by: westonruter <[email protected]>
Summary
Test plan