-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block Directory: Return inactive plugins in search results #23688
Conversation
Size Change: +40 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
The plugin URL will only exist if the plugin is already installed, so we can use that to activate that plugin. We can also use this link for uninstallation, so we make sure to add it into the block object when installing a plugin.
8b21bd0
to
4490234
Compare
method: 'PUT', | ||
} ); | ||
} else { | ||
const response = yield apiFetch( { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, but we could also use the wp:install-plugin
link as a base, and just add the status: active
data.
if ( link && link.length ) { | ||
return link[ 0 ].href; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not incredibly important but @wordpress/url
's getPath
returns undefined
(which we use in controls.js
).
I wonder if it makes sense to follow that convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it locally. Works are expected. Good job!
Description
Fixes #23570 — This skips the check in the search results endpoint that filters out installed blocks, so that installed-but-deactivated blocks are returned. Blocks that are installed will contain an extra link property in the result, which we can use in the install flow to just activate the plugin.
This also changes the uninstallation flow to use the same link property, instead of a custom endpoint property.
How has this been tested?
I updated the unit tests, and manually tested with a combination of locally installed block plugins.
From the original issue:
Types of changes
Bug fix (non-breaking change which fixes an issue)