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

Blog Subscription Widget: deprecate widget and transform to block #21184

Merged
merged 6 commits into from
Oct 19, 2021

Conversation

arcangelini
Copy link
Contributor

Changes proposed in this Pull Request:

With the new current widget block editor, the Blog Subscription widget is redundant. The current Subscription Form block already exists and offers the same functions. This PR removes it from the core/legacy-widget and adds the widget to the REST API to allow a block transforms: to be created.

This will preserve the following settings that exist in the block: show_subscribers_total, subscribe_button, subscribe_placeholder.

Jetpack product discussion

Part of the widget => block project #21069

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

Nope

Testing instructions:

  • Before switching to this PR, go to Customizer ⇢ Widgets and add Legacy Widget choosing Blog Subscription from the dropdown. Be sure to save changes
  • Next switch to this PR and view your customizer.
  • You should see that Blog Subscription is no longer an option in the Legacy Widget block.
  • Now click the previously added Legacy Blog Subscription and use the Transform button to change to the Subscription Form block.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello arcangelini! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D67356-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. labels Sep 24, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2021

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 you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: November 2, 2021.
  • Scheduled code freeze: October 25, 2021.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Sep 24, 2021
@arcangelini
Copy link
Contributor Author

arcangelini commented Sep 24, 2021

The WPCOM test will fail due to the check against widget_types_to_hide_from_legacy_widget_block. After this PR is ready to merge I will add the widget instance to the array in WPCOM test.

Also, the Subscription Form block does not appear to have a section for a success message. Am I missing that somewhere, or is this not a setting available?

@jeherve
Copy link
Member

jeherve commented Sep 24, 2021

the Subscription Form block does not appear to have a section for a success message. Am I missing that somewhere, or is this not a setting available?

We did not implement that setting for the block yet. I logged this here:
#21187

@jeherve jeherve added this to the jetpack/10.2 milestone Sep 24, 2021
@jeherve jeherve added [Status] Needs Team Review [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Sep 24, 2021
@arcangelini arcangelini added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Team Review [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Sep 28, 2021
@arcangelini arcangelini force-pushed the update/blog-subscription-widget-transform branch from 9e5069e to bc9c3a9 Compare September 28, 2021 13:05
@arcangelini
Copy link
Contributor Author

Rebased and removed widget from Legacy block. Tested and everything is working great.

Markup 2021-09-28 at 15 02 47

@arcangelini arcangelini added the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Sep 28, 2021
@arcangelini arcangelini requested review from jeherve and a team September 30, 2021 08:28
@jeherve jeherve removed this from the jetpack/10.2 milestone Sep 30, 2021
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 works well for me. Do you think we could also keep the widget title, in a heading block?

@jeherve jeherve 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 Oct 1, 2021
transform: ( { instance } ) => {
return createBlock( 'jetpack/subscriptions', {
showSubscribersTotal: instance.raw.show_subscribers_total,
submitButtonText: instance.raw.subscribe_button,
Copy link
Contributor

Choose a reason for hiding this comment

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

@arcangelini 👋 have you tried changing it to some different custom string!
Example: submitButtonText: 'Subscribe to my newsletter'.
I tried something similar but it is not working for me somehow! 😞 submitButtonText value is set to default value that you mentioned in the attributes.js file
Can you please try at your end and confirm?
Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, if you look at my last screenshot it shows the placeholder text as "Placeholder" and the submit button as "Button".

I can test again though!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand what this block of code does?

return createBlock( 'jetpack/subscriptions', {
    showSubscribersTotal: instance.raw.show_subscribers_total,
    submitButtonText: instance.raw.subscribe_button,
    subscribePlaceholder: instance.raw.subscribe_placeholder,
} );

If you see in the screenshot, I have commented default value of submitButtonText and if it has to read the value from index.js file instance.raw.subscribe_button then I have given some hard coded value custom button value which is not getting reflected. Button text is empty actually.

POC

Copy link
Contributor

Choose a reason for hiding this comment

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

@arcangelini, no need to test it again. It is working as expected. I understand now when that block of code is going to run.
Thank You 😄

@arcangelini
Copy link
Contributor Author

@jeherve I could, but the problem we have run into is that this heading block doesn't not get placed immediately above the subscription block. The only way to get it to do this would be using a Group block, but due to the way Gutenberg checks the transforms output we can not transform directly to a group block.

In the future, I think there will be a Widget group block to transform to, but this has not gone live in core yet so I have opted to not use this.

This is what it looks like:

Markup 2021-10-10 at 00 39 28

@arcangelini arcangelini added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Oct 9, 2021
@sdixon194
Copy link
Contributor

sdixon194 commented Oct 13, 2021

This works for me! Shame we don't have an option for transforming to a group block just yet (maybe we can open an issue to track that when it's available) but not sure that's a blocker for this PR. What do you think @jeherve ?

@jeherve
Copy link
Member

jeherve commented Oct 13, 2021

Thanks for the explanation. Let's move forward without the titles then! 👍

@arcangelini arcangelini merged commit 9cc4ab2 into master Oct 19, 2021
@arcangelini arcangelini deleted the update/blog-subscription-widget-transform branch October 19, 2021 07:28
@arcangelini
Copy link
Contributor Author

🥳 Deployed to WPCOM r233512-wpcom

@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Oct 19, 2021
@github-actions github-actions bot added this to the jetpack/10.3 milestone Oct 19, 2021
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D67356-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

davidlonjon added a commit that referenced this pull request Oct 19, 2021
* master:
  Releases: start 10.3-a.4 cycle (#21454)
  Atomic Release: prepare changelogs for today's release (#21453)
  Connection: fixing the bug with connect button not appearing for secondary users (#21450)
  CLI: Add readme to 'jetpack release' (#21418)
  Update handling and setting CCPA related cookies (#21337)
  Publicize: do not disable toggle connection control when RePublicize is enabled (#21373)
  External Media: Add bottom padding to Google Photos modal (#21201)
  Blog Subscription Widget: deprecate widget and transform to block (#21184)
davidlonjon added a commit that referenced this pull request Oct 19, 2021
# By Jeremy Herve (2) and others
# Via GitHub
* master:
  Releases: start 10.3-a.4 cycle (#21454)
  Atomic Release: prepare changelogs for today's release (#21453)
  Connection: fixing the bug with connect button not appearing for secondary users (#21450)
  CLI: Add readme to 'jetpack release' (#21418)
  Update handling and setting CCPA related cookies (#21337)
  Publicize: do not disable toggle connection control when RePublicize is enabled (#21373)
  External Media: Add bottom padding to Google Photos modal (#21201)
  Blog Subscription Widget: deprecate widget and transform to block (#21184)

# Conflicts:
#	projects/plugins/boost/tests/e2e/package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Subscriptions [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Feature] Widget Visibility [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files [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.

5 participants