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

Newsletter settings: add toggle for showing a subscribe modal after commenting #37699

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

simison
Copy link
Member

@simison simison commented Jun 4, 2024

Adds a missing toggle to Jetpack settings.

The toggle and feature is already available on WP.com sites and Calypso settings. The Dotcom team implementing this originally just didn't get to add the Jetpack side (convo), so this is a follow up to that.

Calypso newsletter settings:

image

Jetpack newsletter settings:

Screenshot 2024-06-20 at 13 55 01

After filling commenting field and submitting a comment:

Screenshot 2024-06-20 at 13 53 03

You will see a modal pop-up prefilled with the email you used for commenting:

Screenshot 2024-06-20 at 13 52 23

Proposed changes:

  • Release "show subscribe modal after commenting" feature to Jetpack sites; previously it was available only for WP.com sites.

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:

  • See PR description

@simison simison added the [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. label Jun 4, 2024
@simison simison requested a review from a team June 4, 2024 12:12
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress Admin Page React-powered dashboard under the Jetpack menu labels Jun 4, 2024
Copy link
Contributor

github-actions bot commented Jun 4, 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.


Once your PR is ready for review, check one last time that all required checks 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:

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

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for August 6, 2024 (scheduled code freeze on July 29, 2024).

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

Copy link
Contributor

github-actions bot commented Jun 4, 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/subscribe-toggle-comment-form branch.

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

    bin/jetpack-downloader test jetpack update/subscribe-toggle-comment-form
    

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

@simison
Copy link
Member Author

simison commented Jun 4, 2024

Removed couple "is Atomic" checks and added template edit/preview link.

@simison
Copy link
Member Author

simison commented Jun 4, 2024

Needs more work, as currently results in error:

Screenshot 2024-06-04 at 14 52 44

@pkuliga can you spot what's missing for the toggle to work on Jetpack site? By the looks the option seems to be available.

Looks like this fixed it for saving the setting at least.

'jetpack_verbum_subscription_modal' => array(
'description' => esc_html__( 'Show subscription pop-up after commenting on a post', 'jetpack' ),
'type' => 'boolean',
'default' => 0,
Copy link
Member Author

@simison simison Jun 4, 2024

Choose a reason for hiding this comment

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

In get_option the default value seems to be true, so need to check how this works.

Edit: we should enable it by default here, too. Then the logic is just if the "Jetpack commenting" is enabled or not.

Edit: changed to 1 in 5b20095

@simison simison force-pushed the update/subscribe-toggle-comment-form branch from fc81b26 to 1cc4998 Compare June 20, 2024 10:21
@@ -711,17 +711,10 @@ public function add_comment_meta( $comment_id ) {
* @return boolean
*/
public function should_show_subscription_modal() {

// Not allow it to run on self-hosted or simple sites
Copy link
Member Author

Choose a reason for hiding this comment

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

Regardless of the comment, this was disabled only at Jetpack sites.

The code reads "IF NOT simple or atomic site, OR NOT simple site, don't enable modal".

@simison
Copy link
Member Author

simison commented Jun 20, 2024

@lupus2k, I'm a bit confused by appSource being atomic-subscription-modal-lo here, but in the event (wpcom_blog_email_subscribe) and Superset dashboards I see verbum-subscription-modal?

<!-- wp:jetpack/subscriptions {"borderRadius":50,"className":"is-style-compact","appSource":"atomic-subscription-modal-lo"} /-->

@lupus2k
Copy link
Contributor

lupus2k commented Jun 20, 2024

@lupus2k, I'm a bit confused by appSource being atomic-subscription-modal-lo here, but in the event (wpcom_blog_email_subscribe) and Superset dashboards I see verbum-subscription-modal?

<!-- wp:jetpack/subscriptions {"borderRadius":50,"className":"is-style-compact","appSource":"atomic-subscription-modal-lo"} /-->

We have more detailed track events in the P2 here: pb5gDS-3tB-p2

As Jetpack uses subscribe.wordpress.com/memberships/ to subscribe the user and, in some cases, does not detect that the user was logged in due to cookie blocking (like Enhanced tracking protection in Firefox), causing wrong tracking events, we decided to pass the information about the login-status using app_source

Copy link
Contributor

@heavyweight heavyweight left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!
LGTM

Copy link
Contributor

@lupus2k lupus2k left a comment

Choose a reason for hiding this comment

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

LGTM!

@simison simison force-pushed the update/subscribe-toggle-comment-form branch from 2cbe96b to cf016e8 Compare July 1, 2024 17:31
The value might be misleading (due "atomic") but it serves simple, jetpack and atomic sites. There are dashboards created for the modal so it doesn't make sense to change this by platform.
@simison
Copy link
Member Author

simison commented Jul 2, 2024

@heavyweight I was looking into this again and this time I'm seeing an issue in incognito Chrome & Safari.

Unhandled Promise Rejection: ForbiddenError: Not Authorized
verbum-comments.js

Screenshot 2024-07-02 at 15 06 21

Do you know if that's the same problem you fixed elsewhere earlier?

@simison simison force-pushed the update/subscribe-toggle-comment-form branch from cf016e8 to 69b796c Compare July 2, 2024 12:08
@heavyweight
Copy link
Contributor

@heavyweight I was looking into this again and this time I'm seeing an issue in incognito Chrome & Safari.

Unhandled Promise Rejection: ForbiddenError: Not Authorized
verbum-comments.js

Screenshot 2024-07-02 at 15 06 21

Do you know if that's the same problem you fixed elsewhere earlier?

It's hard to tell.
This is an error when checking if the user is authenticated/logged in.
It's completely normal to get that status when you are not logged in. But if you are already logged in that would indicate potential cookie issues.
In anyway it's not PR related for sure.

Copy link
Contributor

github-actions bot commented Oct 2, 2024

This PR has been marked as stale. This happened because:

  • It has been inactive for the past 3 months.
  • It hasn’t been labeled `[Pri] BLOCKER`, `[Pri] High`, etc.

If this PR is still useful, please do a [trunk merge or rebase](https://github.com/Automattic/jetpack/blob/trunk/docs/git-workflow.md#keeping-your-branch-up-to-date) and otherwise make sure it's up to date and has clear testing instructions. You may also want to ping possible reviewers in case they've forgotten about it. Please close this PR if you think it's not valid anymore — if you do, please add a brief explanation.

If the PR is not updated (or at least commented on) in another month, it will be automatically closed.

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 [Feature] Comments [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Needs Team Review [Status] Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants