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

Donations: Save block content #16705

Merged
merged 7 commits into from
Aug 6, 2020
Merged

Donations: Save block content #16705

merged 7 commits into from
Aug 6, 2020

Conversation

mmtr
Copy link
Member

@mmtr mmtr commented Aug 4, 2020

Changes proposed in this Pull Request:

  • Adds support for saving the content of a donations block into the post content, so the published view contains the block output.
    Aug-04-2020 19-29-16

  • It also follows up Donations block: Make currency and amounts editable #16593 (comment) and implements the content sync logic as suggested there:

    • Content synced across all tabs:
      • Text before fixed amounts (e.g. "Choose an amount").
      • Text before custom amount input (e.g. "Or enter a custom amount").
      • Donate buttons labels (e.g. "Donate"). They have defaults that are specific to tabs ("Donate", "Donate monthly", "Donate yearly"), but changing any of those would override and sync across all tabs.
    • Content not synced across all tabs (each tab has different items):
      • Heading (e.g. "Make a one-time donation").
      • Fixed amounts.
      • Text before donate button (e.g. "Your contribution is appreciated.").

Jetpack product discussion

pbMlHh-dW-p2

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

No.

Testing instructions:

  • With a WordPress instance of your choice, install Jetpack Beta and activate this branch. Or visit https://jurassic.ninja/create/?jetpack-beta&branch=update/donations-block-save.
  • Connect Jetpack to WordPress.com with a paid plan.
  • Make sure Jetpack beta blocks are visible by going to /wp-admin/options-general.php?page=companion_settings and activating JETPACK_BETA_BLOCKS.
  • Note that if folks are using the sandbox store method (PCYsg-lW4-p2) to also set the JETPACK__SANDBOX_DOMAIN value.
  • Go to Posts > New and insert a Donations block.
  • Edit the block at your pleasure and publish the post.
  • Make sure the content is synced across tabs according to Donations block: Make currency and amounts editable #16593 (comment).
  • Visit the published post.
  • Make sure the block is displayed there and that it looks visually the same as in the editor.
  • Make sure only the relevant content for the active tab is displayed.
  • Make sure the custom amount input behaves as expected (you can enter an amount, invalid amounts are highlighted with a red border, valid amounts are formatted when the input loses focus).
  • Reload the post in the editor.
  • Make sure the saved block content is loaded.

Proposed changelog entry for your changes:

N/A.

@mmtr mmtr requested a review from a team August 4, 2020 12:07
@mmtr mmtr self-assigned this Aug 4, 2020
@jetpackbot
Copy link
Collaborator

jetpackbot commented Aug 4, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16705

Scheduled Jetpack release: September 1, 2020.
Scheduled code freeze: August 25, 2020

Generated by 🚫 dangerJS against b19a7ae

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello mmtr! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D47565-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

@mmtr mmtr added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Aug 4, 2020
@kwight
Copy link
Contributor

kwight commented Aug 4, 2020

Front-end looks great 🎉

It looks like there's some regressions with the amount handling though. I can have valid values rejected (eg. 15.34), and the block can eventually crash (Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.).

@mmtr
Copy link
Member Author

mmtr commented Aug 5, 2020

It looks like there's some regressions with the amount handling though. I can have valid values rejected (eg. 15.34), and the block can eventually crash

Oh, nice catch! Should've been addressed in acda908.

@mmtr mmtr added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Aug 5, 2020
@mmtr mmtr dismissed a stale review via 672d7d2 August 5, 2020 11:10
@mmtr mmtr added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Aug 5, 2020
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 looks good to me right now. 👍

@jeherve jeherve added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] Needs Review This PR is ready for review. labels Aug 5, 2020
@kwight
Copy link
Contributor

kwight commented Aug 5, 2020

Yep, latest fix looks good!

@kwight kwight added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Aug 5, 2020
@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Aug 5, 2020
@mmtr mmtr merged commit e3860aa into master Aug 6, 2020
@mmtr mmtr deleted the update/donations-block-save branch August 6, 2020 08:35
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Aug 6, 2020
@github-actions github-actions bot added this to the 8.9 milestone Aug 6, 2020
davidlonjon added a commit that referenced this pull request Aug 6, 2020
* master:
  UI changes to prepare to make Social Previews a gated feature on WPCom (#16724)
  Donations: Save block content (#16705)
pereirinha pushed a commit that referenced this pull request Sep 10, 2020
* Adds support for saving the content of a donations block into the post content, so the published view contains the block output.
* It also follows up #16593 (comment) and implements the content sync logic as suggested there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants