Skip to content
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

Blaze: introduce Blaze module #31479

Merged
merged 13 commits into from
Jun 26, 2023
Merged

Blaze: introduce Blaze module #31479

merged 13 commits into from
Jun 26, 2023

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Jun 21, 2023

Fixes #29294

Warning
This depends on #30103 and #31485 being merged.

Proposed changes:

Instead of loading Blaze automatically and only providing a code snippet to disable it, let's make it a module (automatically enabled upon connection to WordPress.com) that can be disabled via the modules as well as the Settings page.

This will be especially important once #30103 will be merged and the new dashboard will be enabled, since the Blaze feature will then have its own menu in the dashboard, and will thus become more prominent in WordPress dashboards.

Since the feature becomes a module, we do not need to include it in the Config package anymore. It will be initialized when the module is activated.

Note
The new module will be automatically activated when new sites connect to WordPress.com or when sites are updated to the next version of Jetpack. However, on your test site using the Beta plugin or on your local development site, the module will not be automatically updated. You'll consequently have the feature disabled when you start testing.

UI Changes

This PR introduces UI changes in 2 different interfaces:

  • The old modules page at wp-admin/admin.php?page=jetpack_modules, where you'll see a new "Blaze" item.
  • A new card in Jetpack > Settings > Traffic

Screenshots

Here are some screenshots of the different use-cases you may find in Jetpack > Settings > Traffic:

Offline mode
Screenshot 2023-06-21 at 12 43 35

Feature disabled on the site

for example via add_filter( 'jetpack_blaze_enabled', '__return_false' );

image

Inactive

image

Active with the new Dashboard enabled

via add_filter( 'jetpack_blaze_dashboard_enable', '__return_true' );

image

Active with the new Dashboard not active yet

This should be the default, does not require any filter:

image

Site connected, but user not connected
Screenshot 2023-06-21 at 12 44 52

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Related PRs:

Does this pull request change what data or activity we track or use?

  • No

Testing instructions:

Here are some basic tests:

  • Go to Jetpack > Settings > Traffic.
  • Enable the Blaze feature.
  • Go to Posts > All Posts, and notice the Blaze CTA links when hovering the published posts.
  • Go to Jetpack > Settings > Modules
  • Check that when clicking on Blaze you're redirected to the Blaze support docs.
  • Disable the module.
  • Go back to Posts > All Posts: the links should be gone.

For more advanced tests, I would recommend playing with the filters I mentioned above.

@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Pri] Normal [Extension] Blaze [Package] Blaze labels Jun 21, 2023
@jeherve jeherve added this to the jetpack/12.3 milestone Jun 21, 2023
@jeherve jeherve self-assigned this Jun 21, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 21, 2023

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack plugin. Once the plugin is active, go to Jetpack > Jetpack Beta > Jetpack and enable the update/blaze-module branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack update/blaze-module
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Package] Config [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Docs labels Jun 21, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 21, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

  • Next scheduled release: July 5, 2023.
  • Scheduled code freeze: June 26, 2023.

@github-actions github-actions bot added the Admin Page React-powered dashboard under the Jetpack menu label Jun 21, 2023
@jeherve jeherve changed the base branch from trunk to add/blaze-eligibility-endpoint June 21, 2023 14:55
@jeherve jeherve added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Jun 23, 2023
Base automatically changed from add/blaze-eligibility-endpoint to trunk June 23, 2023 16:35
@samiff samiff self-requested a review June 23, 2023 17:25
samiff
samiff previously approved these changes Jun 23, 2023
Copy link
Contributor

@samiff samiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tested well for me 👍

My only question was regarding the Calypso side of things, is there plan to take into account the module/filter setting there (wordpress.com/posts/example.com)? Or should that always show the "Promote with Blaze" option?

@samiff samiff added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jun 23, 2023
@jeherve
Copy link
Member Author

jeherve commented Jun 26, 2023

My only question was regarding the Calypso side of things, is there plan to take into account the module/filter setting there (wordpress.com/posts/example.com)? Or should that always show the "Promote with Blaze" option?

That's a good point. I had initially thought that this should always appear, given that the Advertising menu in there always appears, but after your account I'm starting to have my doubts. Maybe the whole thing should disappear then?

If it does, we have 2 options to do that:

  1. We could update the eligibility endpoint with D114507-code to consider a site non-eligible to Blaze when the module is disabled (it would also require some changes in this PR, see below) since we would want to still allow you to turn the module on when your site is not eligible yet). I'm not a big fan of this approach since I think a site can be considered eligible for Blaze when the module is off.
diff --git a/projects/plugins/jetpack/_inc/client/traffic/blaze.jsx b/projects/plugins/jetpack/_inc/client/traffic/blaze.jsx
index 3befd68308..acc51f70fb 100644
--- a/projects/plugins/jetpack/_inc/client/traffic/blaze.jsx
+++ b/projects/plugins/jetpack/_inc/client/traffic/blaze.jsx
@@ -57,15 +57,6 @@ function Blaze( props ) {
 	};
 
 	const blazeToggle = () => {
-		if ( ! blazeAvailable ) {
-			return (
-				<ToggleControl
-					disabled={ true }
-					label={ __( 'Blaze is not available on your site.', 'jetpack' ) }
-				/>
-			);
-		}
-
 		return (
 			<ModuleToggle
 				slug="blaze"
  1. We could merge this PR as is, and then update Calypso to add a check for the module on top of the eligibility check. That would be my preferred approach personally. Here is PR for it: Blaze: add Jetpack module control wp-calypso#78637

What do you think?

@jeherve
Copy link
Member Author

jeherve commented Jun 26, 2023

Coming back to this discussion, I committed 06f80b0 to hide the card on WoA sites, where we'll want the feature to be available by default, like the WordPress.com toolbar. In parallel to that, I've opened 1416-gh-Automattic/wpcomsh to ensure the feature is available on WoA sites.

@jeherve jeherve added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 26, 2023
jeherve added a commit to Automattic/wp-calypso that referenced this pull request Jun 26, 2023
Related PR: Automattic/jetpack#31479

On self-hosted sites, folks can use the Blaze module to toggle the feature on and off. We consequently need to take this into account when we want to display Blaze UI elements in Calypso.

However, we must take a few things into account:

- On WordPress.com simple sites, the module will always be on.
- On older versions of Jetpack, the module will not exist.
Copy link
Contributor

@samiff samiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could merge this PR as is, and then update Calypso to add a check for the module on top of the eligibility check

I like this approach more 👍

I committed 06f80b0 to hide the card on WoA sites

Makes sense and tested well for me.

@samiff samiff added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jun 26, 2023
@samiff samiff merged commit 5532987 into trunk Jun 26, 2023
58 of 59 checks passed
@samiff samiff deleted the update/blaze-module branch June 26, 2023 17:21
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jun 26, 2023
@jeherve jeherve mentioned this pull request Jul 5, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu Docs [Extension] Blaze [Package] Blaze [Package] Config [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blaze showing up by default on all my sites with Jetpack
2 participants