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

Subscriptions: stop loading subscribe block and panels when module disabled #39802

Merged

Conversation

simison
Copy link
Member

@simison simison commented Oct 17, 2024

Subscriptions: stops loading editor functionality (i.e. the block and panels) when subscriptions module is disabled.

Resolves #39800
Resolves #40230

Proposed changes:

  • Dont'load the JS code at all when module is disabled
  • Remove "enable module" nudges from JS since those aren't loaded anymore

Newsletter in the header icon will be no more, and the subscribe block won't show up in block pickers:

Screenshot 2024-11-22 at 15 51 38

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

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

Testing instructions:

  • Block and panels work when subscriptions module is enabled from "Jetpack -> Settings -> Newsletter"

  • You won't find any functionality in the editor when module is disabled:

    image

Copy link
Contributor

github-actions bot commented Oct 17, 2024

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 Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the update/stop-loading-subscribe-block-when-module-disabled branch.

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

    bin/jetpack-downloader test jetpack update/stop-loading-subscribe-block-when-module-disabled
    

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 [Block] Subscriptions [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Oct 17, 2024
Copy link
Contributor

github-actions bot commented Oct 17, 2024

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.
  • 🔴 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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for none scheduled (scheduled code freeze on undefined).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@simison simison added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Oct 17, 2024
@crisbusquets
Copy link
Contributor

Works for me. I tested this on a JN site. Thanks for working on this! 🙏

Jetpack connected
Screenshot 2024-10-17 at 12 00 51

WordPress.com account connected, Newsletter disabled
Screenshot 2024-10-17 at 12 01 40

WordPress.com account connected, Newsletter enabled
Screenshot 2024-10-17 at 12 02 08

@crisbusquets
Copy link
Contributor

This is also nice, @simison 🚀

Screenshot 2024-10-17 at 12 03 55

* Do not proceed if the newsletter feature is not enabled
* or if the 'Jetpack_Memberships' class does not exists.
*/
if ( ! class_exists( '\Jetpack_Memberships' ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

It was a bit weird to see this class check here since we just import the file a few lines above:

require_once JETPACK__PLUGIN_DIR . '/modules/memberships/class-jetpack-memberships.php';

So I removed the check as a redundant.


if ( \Jetpack_Memberships::should_enable_monetize_blocks_in_editor() ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Function name could be improved but works for now.

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This essentially removes the work we had done in #29044. This introduces a discrepancy with the other blocks that rely on a module, and that will remain always available. is that okay?

Could we instead hide the newsletter icon, but keep the placeholders to invite folks to turn the feature on?

@simison
Copy link
Member Author

simison commented Oct 17, 2024

Could we instead hide the newsletter icon, but keep the placeholders to invite folks to turn the feature on?

It's an option, yes. I'm little less worried about undoing work (although it's a bummer) and more interested in finding best possible UX. :-)

Happy to have the product convo in a P2 regarding other blocks, before committing to this!

@jeherve
Copy link
Member

jeherve commented Oct 18, 2024

Happy to have the product convo in a P2 regarding other blocks, before committing to this!

It may be worth a discussion on +jpopdesignp2 I think. I don't have a strong opinion on the matter personally, but I think it would make sense to have a consistent approach. If we were to remove the placeholders for one block, we should probably do it for all. I think there are arguments for it, performance could be one of them.

@crisbusquets
Copy link
Contributor

Happy to have the product convo in a P2 regarding other blocks, before committing to this!

It may be worth a discussion on +jpopdesignp2 I think. I don't have a strong opinion on the matter personally, but I think it would make sense to have a consistent approach. If we were to remove the placeholders for one block, we should probably do it for all. I think there are arguments for it, performance could be one of them.

My thoughts: When a user opens Gutenberg, they're usually focused on writing content for their site, not exploring new features. Sure, they could come across new features, but that's not the main goal for this UI.

I think we can find better opportunities to introduce features within the WP Admin or Jetpack, rather than adding more icons to Gutenberg that users may not need right away (or maybe never).

I'm not entirely sure we have a one-size-fits-all approach, it probably depends on the feature. AI, for example, directly helps with writing, so that one makes sense to keep.

@kraftbj kraftbj added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 12, 2024
@simison simison force-pushed the update/stop-loading-subscribe-block-when-module-disabled branch 3 times, most recently from 1501f5e to eec3ab3 Compare November 20, 2024 17:30
@simison simison force-pushed the update/stop-loading-subscribe-block-when-module-disabled branch from eec3ab3 to 22f8a36 Compare November 22, 2024 13:05
lezama
lezama previously approved these changes Nov 22, 2024
@simison simison merged commit c214fbf into trunk Nov 26, 2024
58 checks passed
@simison simison deleted the update/stop-loading-subscribe-block-when-module-disabled branch November 26, 2024 11:48
@github-actions github-actions bot removed the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Nov 26, 2024
@simison
Copy link
Member Author

simison commented Nov 26, 2024

@jeherve I was reviewing a bit placehodler status for other features:

While Newsletters feature has a clear'ish "on/off" toggle (it could be better discoverable but that's separate issue), not all features do have it:

Screenshot 2024-11-26 at 13 56 55

For example Related posts has a toggle which adds classic related posts to posts:

Screenshot 2024-11-26 at 13 56 43

Having that toggle control the block is kinda meaningless since related posts would just appear in your posts, you don't need to deal with the block anymore. Once related posts is updated to use block hooks, hiding the block when module is disabled is more meaningful.

Screenshot 2024-11-26 at 13 55 17

There are likely similar UX issues with other blocks, and placeholders are kinda "hack" to improve otherwise poor UX for enabling and discovering features, but have a tradeoff of contributing to the bloated feeling of Jetpack.

@jeherve
Copy link
Member

jeherve commented Nov 26, 2024

There are likely similar UX issues with other blocks, and placeholders are kinda "hack" to improve otherwise poor UX for enabling and discovering features, but have a tradeoff of contributing to the bloated feeling of Jetpack.

Yup, that's very true.

Interestingly, the concept of modules also contributed to fight the idea of bloat since when a module is inactive, code for that feature didn't run on the site.
If we were to do away with that, and for example always load the related posts codebase so the block is available without having to activate a module, we would do away with that concept. I'm honestly not quite sure how to best address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Subscriptions [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests
Projects
None yet
5 participants