-
Notifications
You must be signed in to change notification settings - Fork 384
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
Add back-compat to old WP versions for new v2.2 features #6773
Conversation
…PluginActivationSiteScan
@delawski Is there a need to include non-active themes in the response? I suppose so since it seems that a parent theme is not included in the list if you add |
It may be worthwhile to limit the queried themes and plugins to just those which are active, as if there are many themes and plugins installed will they all be included in the response? Actually, that brings to mind: what if there are hundreds of installed plugins and hundreds of installed themes? It seems that there is no pagination for either of the |
On WordPress 5.4 and older, the themes and plugins REST endpoints are not available. We use them in Site Scan for providing a source name, version, and author instead of a bare slug. Since this information is supplementary, we can fail silently if the endpoints are not available.
I've pushed a few commits that should fix the Site Scan on AMP Settings screen and in the Onboarding Wizard. The scanner works now even though the Based on this assumption, I made the themes and plugins requests to fail silently in f57f25c. Also, in 148d397 I've limited the fields we're requesting for themes and plugins. I haven't touched the pagination issue, though. Lastly, with 3f3cb57 the Onboarding Wizard should work fine on WP 4.9. |
Plugin builds for ff7e7b7 are ready 🛎️!
|
Codecov Report
@@ Coverage Diff @@
## develop #6773 +/- ##
=============================================
- Coverage 78.29% 77.47% -0.82%
- Complexity 6693 6700 +7
=============================================
Files 203 268 +65
Lines 20150 21356 +1206
=============================================
+ Hits 15776 16546 +770
- Misses 4374 4810 +436
Flags with carried forward coverage won't be shown. Click here to find out more.
|
When testing Twenty Seventeen in WP 4.9, I was surprised to see a script error coming from This is due to the |
In Wordpress 5.2.13 I see something weird where the REST API call to obtain the settings data is:
Note there is no This is true of all the REST API URLs: This error doesn't occur in WP 5.3.10, so there's something uniquely broken about WP 5.2.x. |
@delawski I think this was actually fixed by #6776 since without that chance I get errors in those 3 scripts: If I revert your change in 3f3cb57 after having merged |
517eb64
to
30b78fc
Compare
// shown, and its the user interface which is particularly problematic on older versions of WP due to the | ||
// JavaScript dependencies. | ||
if ( ! $this->dependency_support->has_support() ) { | ||
return false; // @codeCoverageIgnore |
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.
It seems that because of this check, it's impossible to toggle developer tools on WP 4.9-5.5. Is it intended?
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.
I think we should just prevent users access to validation screens in WP<5.6.
@westonruter Actually, in light of #6775 (comment), do you think we should disable developer tools on WP<5.6, too? If yes, then we should hide the toggle here and also remove one of the steps in the Onboarding Wizard.
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.
That's a good question. Developer tools access is broken down into two aspects:
- Capability check: the users should never have access to DevTools (or the validation nonce)
- Preference check: validation data should not be presented to the user.
In the case of a user being on an old WP install, the latter check is more appropriate because what we're wanting to do is to prevent displaying the validation UI to the user since it won't work properly. Technically such a user could still manually go to the validation screens if they know the URLs, but that is OK since they still have the capability and we aren't blocking their access.
So I think we can keep the step in the Onboarding Wizard. It's just we won't link to the Validated URLs screen.
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.
I'm not sure if we're on the same page. Here's a recording of what I meant (notice that the response's payload always returns amp_dev_tools_enabled: false
meaning the "Enable Developer Tools" toggle is useless):
Screen.Recording.2021-12-13.at.09.30.17.PM.mp4
The same applies to the Technical Background step of the Wizard.
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.
Oh! I see what you're referring to.
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.
I've addressed this in ff7e7b7 by hiding the toggle which appears on the settings screen as well as the toggle that appears on the user profile screen.
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.
also remove one of the steps in the Onboarding Wizard.
@delawski Oh, I didn't do this part. If you would open a PR to address this, I'd appreciate it. It's consider this not to be a blocker for 2.2, since it only affects WP<5.6 (which granted is about a third of all installs).
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.
Sure! This one seems to be easy: #6789.
Also remove invaid codeCoverageIgnore tags
QA Passed. ✅ AMP Plugin/Theme is only highlighted in 5.6 and the newer versions of WordPress. ✅ Site scanning is disabled after plugin activation in the WordPress version prior to 5.6 ✅ Support page is only available in 5.2 and the newer versions of WordPress. ✅ Did not find any issue on the "AMP Setting" screen and "Onboarding Wizard" in WordPress 4.9 |
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.
Changes in PR looks good to me.
Test new (and existing) plugin features in WordPress 4.9 and above. Add todos for fixing below:
status=active
parameter to/wp/v2/themes
REST API calls for compat with WP<5.7. (See https://core.trac.wordpress.org/ticket/50152)_fields
requested form theplugins
andthemes
endpoints to be just those which are needed.Fixes #6775.
Closes #6771.