Skip to content

Conversation

@samiff
Copy link
Contributor

@samiff samiff commented Dec 7, 2022

Changes proposed in this Pull Request:

Migration of coming-soon feature from the ETK plugin.

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?

Jetpack product discussion

PT: p9dueE-6jY-p2

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

No.

Testing instructions:

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

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 Mu wpcom plugin:

  • Next scheduled release: January 3, 2023.
  • Scheduled code freeze: December 26, 2022.

@samiff
Copy link
Contributor Author

samiff commented Dec 7, 2022

@anomiex I imagine for migrated PHP tests we'd want to use wordbless? Here is the ETK bootstrap.php for reference. I've given that a shot in e10a182f2511bbda0a4bee4cb310b598bd9f19c3 but thought I'd check in before continuing further.

Edit: also merged D94672-code which seemed to work ok.

@anomiex
Copy link
Contributor

anomiex commented Dec 8, 2022

Using WorDBless would be good if it's possible, it makes it easier for people to run tests locally. OTOH, in CI all plugins are set up inside a copy of WordPress, so if that's what it needs it can use it.

@samiff
Copy link
Contributor Author

samiff commented Dec 8, 2022

@anomiex

Just wanted to get a gut-check in regards to deploy:

  • In this plugin we're checking has_action( 'plugins_loaded', 'A8C\FSE\load_coming_soon' ) before loading coming-soon, and my plan was to add a similar check on the Calypso side checking for Jetpack\Mu_Wpcom\load_coming_soon before loading the feature.
    • Checks on both side since there isn't a guarantee of plugin load order from what I read, unless I'm missing a different strategy?
  • If the above makes sense, that change in ETK plugin would get deployed to simple and Atomic.
  • Then this plugin could safely be activated on simple and Atomic.
  • Finally, remove the checks and coming-soon code from ETK.

Does that sound about right to you?

@anomiex
Copy link
Contributor

anomiex commented Dec 9, 2022

Just wanted to get a gut-check in regards to deploy

That sounds like a good plan.

I believe that the loading order will be consistent (because plugin load order is alphabetical AFAIK), but what that order will actually be I don't know. And might differ between Simple and Atomic.

samiff added a commit to Automattic/wp-calypso that referenced this pull request Dec 9, 2022
samiff added a commit to Automattic/wp-calypso that referenced this pull request Dec 9, 2022
@github-actions github-actions bot added [Block] Contact Form Form block (also see Contact Form label) [Block] VideoPress [Package] VideoPress [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Super Cache A fast caching plugin for WordPress. Docker labels Dec 9, 2022
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

I'm kind of confused on why the $blog_id is needed here to begin with if this ETK code is always running via a plugin.

Running via a plugin doesn't matter. The blog ID is needed when it's running on a multi-site, and probably on Simple too.

For the second one, that test is failing because wordbless doesn't support add_blog_option as used by add_option_to_new_site().

More specifically, the relevant file (ABSPATH . '/wp-includes/ms-blogs.php') isn't loaded by default because it's not a multisite site. I don't know whether WorDBless supports being a multisite or not, but it does seem to work if you manually require that file. Or you could just mock the relevant function to call add_option().

@samiff
Copy link
Contributor Author

samiff commented Dec 13, 2022

The blog ID is needed when it's running on a multi-site, and probably on Simple too.

Thanks, I didn't notice what this was doing by hooking into wpmu_new_blog but understand now.

Or you could just mock the relevant function to call add_option().

As far as mocking goes, how does bd13825 look?

@samiff samiff requested a review from anomiex December 13, 2022 20:16
@samiff
Copy link
Contributor Author

samiff commented Dec 13, 2022

Error: main: Task checkDescription failed with error: TypeError: Cannot read properties of undefined (reading 'automattic/jetpack-changelogger')

Hmm thought it was something to do with the empty changelog, but that didn't seem to help: c50d89e Any idea on what the snag is, or how I can get more helpful error output (e.g., line number)?

"description": "Enhances your site with features powered by WordPress.com",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"require": {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm thought it was something to do with the empty changelog, but that didn't seem to help: c50d89e Any idea on what the snag is, or how I can get more helpful error output (e.g., line number)?

I don't know about getting more helpful output, but I suspect it's because of this removal and the code at

For this PR, try adding this back. In a separate PR, we should change that code to use ?. for the accesses so it doesn't error out for something like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a separate PR, we should change that code to use ?. for the access

Nice catch! I'll be sure to follow up on that one 👍

anomiex
anomiex previously approved these changes Dec 16, 2022
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

I haven't tested it, but the code looks good to me.

@samiff samiff merged commit 2340ac2 into trunk Dec 16, 2022
@samiff samiff deleted the add/coming-soon-to-wpcom-mu branch December 16, 2022 18:16
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Dec 16, 2022
samiff added a commit that referenced this pull request Jan 20, 2023
Copy/paste of the code, will refactor in following commits.
samiff added a commit that referenced this pull request Feb 6, 2023
* Add jetpack-mu-wpcom-plugin skeleton

* Require the jetpack-mu-wpcom package

* Add test bootstrap

* Add some initialization handling

* Migrate code from /pull/27815

Copy/paste of the code, will refactor in following commits.

* changelog

* Require wordbless

* Update paths and namespaces

* Add wordbless to correct composer file

* Init main class in test bootstrap

* changelogs and validity

* Remove plugins/jetpack-mu-wpcom-plugin dir

We are using plugins/mu-wpcom-plugin instead.

* Backport v1.0.0 version release and init next

* Add init for Jetpack_Mu_Wpcom and coming-soon
matticbot pushed a commit to Automattic/jetpack-mu-wpcom that referenced this pull request Feb 6, 2023
* Add jetpack-mu-wpcom-plugin skeleton

* Require the jetpack-mu-wpcom package

* Add test bootstrap

* Add some initialization handling

* Migrate code from Automattic/jetpack/pull/27815

Copy/paste of the code, will refactor in following commits.

* changelog

* Require wordbless

* Update paths and namespaces

* Add wordbless to correct composer file

* Init main class in test bootstrap

* changelogs and validity

* Remove plugins/jetpack-mu-wpcom-plugin dir

We are using plugins/mu-wpcom-plugin instead.

* Backport v1.0.0 version release and init next

* Add init for Jetpack_Mu_Wpcom and coming-soon

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/4107122958
matticbot pushed a commit to Automattic/jetpack-mu-wpcom-plugin that referenced this pull request Feb 6, 2023
* Add jetpack-mu-wpcom-plugin skeleton

* Require the jetpack-mu-wpcom package

* Add test bootstrap

* Add some initialization handling

* Migrate code from Automattic/jetpack/pull/27815

Copy/paste of the code, will refactor in following commits.

* changelog

* Require wordbless

* Update paths and namespaces

* Add wordbless to correct composer file

* Init main class in test bootstrap

* changelogs and validity

* Remove plugins/jetpack-mu-wpcom-plugin dir

We are using plugins/mu-wpcom-plugin instead.

* Backport v1.0.0 version release and init next

* Add init for Jetpack_Mu_Wpcom and coming-soon

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/4107122958
matticbot pushed a commit to Automattic/jetpack-storybook that referenced this pull request Feb 6, 2023
* Add jetpack-mu-wpcom-plugin skeleton

* Require the jetpack-mu-wpcom package

* Add test bootstrap

* Add some initialization handling

* Migrate code from Automattic/jetpack/pull/27815

Copy/paste of the code, will refactor in following commits.

* changelog

* Require wordbless

* Update paths and namespaces

* Add wordbless to correct composer file

* Init main class in test bootstrap

* changelogs and validity

* Remove plugins/jetpack-mu-wpcom-plugin dir

We are using plugins/mu-wpcom-plugin instead.

* Backport v1.0.0 version release and init next

* Add init for Jetpack_Mu_Wpcom and coming-soon

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/4107122958
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.

4 participants