[Gutenberg] Prevent x-post icon showing on self-hosted sites #16507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes WordPress/gutenberg#40546
Description
The x-post icon —
+
— is currently displaying in the formatting toolbar for text-based blocks on self-hosted sites. The icon is unresponsive when tapped, as x-posts currently only work with P2-based themes (which can't be self-hosted at the time of writing).The fix proposed in this PR involves adding a check for whether a site uses the WP.com rest API before enabling the icon. This is inline with the check used to determine whether @mentions are supported on a site.
Testing Steps
To test:
+
icon.Screenshots
Regression Notes
+
icon should be removed.I manually tested the existing x-post functionality on a site with P2 enabled and confirmed it worked as expected. I also tested the formatting toolbar for the paragraph block on a self-hosted site and didn't spot any unexpected regressions/changes.
As this was a small bug fix, I didn't determine that extra automated tests were necessary.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.