-
Notifications
You must be signed in to change notification settings - Fork 812
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
Untangle theme screens #41374
base: trunk
Are you sure you want to change the base?
Untangle theme screens #41374
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCannot generate coverage summary while tests are failing. 🤐 Please fix the tests, or re-run the Code coverage job if it was something being flaky. |
/** | ||
* Displays a banner before the theme browser that links to the WP.com Theme Showcase. | ||
*/ | ||
function wpcom_themes_show_banner() { |
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.
We can't remove this function until it's removed from being called on WPCOM: fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Snqzva%2Qcyhtvaf%2Sjcpbz%2Qgurzrf.cuc%3Se%3Q04155113%23176%2Q179-og
In 02fe4c2 I copied over the files from wpcomsh (the code used for Atomic themes), but this doesn't remove those original files yet. Then in 32b4963, I forked the core |
32e9c8e
to
563f07a
Compare
I'm not sure the best place for this, but just to note this down somewhere, here's how I'm thinking about the work breakdown for the
|
30611da
to
f5f6f49
Compare
Eventually we'll need to figure out how to roll this out - not that it's ready yet, but to think about:
|
I would think so yes. We'd need to copy/paste it every time we merge core in. |
* @param object $theme The theme object. | ||
* @return object The theme object. | ||
*/ | ||
function wpcom_themes_api_theme_object( $theme ) { |
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.
Should this get added to the endpoint itself?
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 left it as a filter (in wpcom_themes_ajax_query_themes
) because that function is copied from core, and our code here needs to run after the body of that function runs.
The alternative would be updating the endpoint, but then we would need to alter the wpcom_themes_ajax_query_themes
more, which could be harder to merge later if there are core changes. I added a note about that to my how to merge comment.
* | ||
* @return array<stdClass> An array with all the WPCom themes. | ||
*/ | ||
protected function fetch_themes( string $cache_key, array $params = array() ): array { |
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.
This function calls the API through HTTP. On Simple sites we can call the code directly, which means that we don't need to wait for an HTTP request. I think we can do this using Client::wpcom_json_api_request_as_blog
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.
Done in 458df77 - we should now be able to modify the API and see the results when testing.
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 reverted this because it was broken, but it should give you an idea how to do it!
I think the first step here could be to open a separate PR to move those files from wpcomsh to here. That will also make the diff easier to grok. |
458df77
to
26b7e86
Compare
I can do this if no one else has yet. |
PR for moving files in the works: https://github.com/Automattic/jetpack/pull/41770/files |
…missions # Conflicts: # projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/wpcom-themes.php
On simple sites, the `stylesheet` includes the path (e.g., `pub/`), while atomic sites don't use this folder structure, so the "installed" theme would not match. In this case, the `id` value is the correct slug.
…ton text is replaced
…er needs to upgrade to another plan
Installed themes on wpcom have prefixed slugs like `pub/*` or `premium/*` due to the file structure, but wporg expects just the theme name (e.g. psychedeli).
f3bd032
to
6d58cde
Compare
Code Coverage SummaryCannot generate coverage summary while tests are failing. 🤐 Please fix the tests, or re-run the Code coverage job if it was something being flaky. |
The commits in f188246 & 6d58cde fix some API merge issues. The first ensures there are no duplicates in the results, so you can search for "Layover" or "Videomaker" and you won't see the community option. The second commit prevents There is an interesting … glitch? i guess — the These both change the |
Fixes #
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: