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

Config Package: Allow for enabling post_list package #20938

Merged
merged 13 commits into from
Sep 21, 2021

Conversation

allilevine
Copy link
Member

@allilevine allilevine commented Sep 2, 2021

Fixes #21102
Part of #20941

Changes proposed in this Pull Request:

Jetpack product discussion

N/A

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

N/A

Testing instructions:

  • Follow the "Usage" instructions:
    • Require both the config and post_list packages:
      cd projects/plugins/jetpack && composer require automattic/jetpack-post-list
      composer require automattic/jetpack-config
    • Install the monorepo:
      pnpm install
      jetpack install -r && jetpack install --all
    • Initialize the configuration package with the post_list slug:
      Create a file named 0-functions.php in the tools/docker/mu-plugins/ directory and add:
use Automattic/Jetpack/Config;

// Configuring Jetpack as early as plugins_loaded priority 1
// to make sure every action handler gets properly set.
add_action( 'plugins_loaded', 'configure_jetpack', 1 );

function configure_jetpack() {
    $config = new Config();
    $config->ensure( 'post_list' );
}
  • Build and start the docker env:
    jetpack build packages/post-list
    jetpack docker up
  • Go to http://localhost/wp-admin/edit.php (the post list) and check that the post thumbnails appear.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 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.


Beta plugin:

  • Next scheduled release: October 5, 2021.
  • Scheduled code freeze: September 27, 2021.

Jetpack plugin:

  • Next scheduled release: October 5, 2021.
  • Scheduled code freeze: September 28, 2021.

Debug Helper plugin:

  • Next scheduled release: October 5, 2021.
  • Scheduled code freeze: September 27, 2021.

Backup plugin:

  • Next scheduled release: October 12, 2021.
  • Scheduled code freeze: October 8, 2021.

Vaultpress plugin:

  • Next scheduled release: October 5, 2021.
  • Scheduled code freeze: September 27, 2021.

Boost plugin:

  • Next scheduled release: September 30, 2021.
  • Scheduled code freeze: September 25, 2021.

Search plugin:

  • Next scheduled release: October 5, 2021.
  • Scheduled code freeze: September 27, 2021.

@allilevine allilevine force-pushed the update/config-class-with-post-list branch from a5b78bb to a6e9109 Compare September 14, 2021 20:47
@allilevine allilevine marked this pull request as ready for review September 15, 2021 15:28
@github-actions github-actions bot added [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Debug Helper Debug Tools plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] VaultPress labels Sep 15, 2021
@allilevine allilevine force-pushed the update/config-class-with-post-list branch from 32351e5 to debcc6f Compare September 15, 2021 19:23
@pablinos pablinos requested a review from a team September 15, 2021 21:06
Copy link
Contributor

@retrofox retrofox 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 trying to add the package to the Jetpack plugin, adding a new item into this packages list, something like the following:

foreach (
	array(
		'sync',
		'jitm',
		'post_list',
	)
	as $feature
) {
	$config->ensure( $feature );
}

However, for some reason, getting this notice:

[16-Sep-2021 10:09:04 UTC] PHP Notice:  Unable to load class Automattic\Jetpack\Post_List.
Please add the package that contains it using composer and make sure you are requiring the Jetpack autoloader
in /usr/local/src/jetpack-monorepo/projects/packages/config/src/class-config.php on line 129

composer.json and composer.lock are updated into the Jetpack plugin folder, too.

@matticbot matticbot added the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label Sep 17, 2021
@allilevine
Copy link
Member Author

However, for some reason, getting this notice:

[16-Sep-2021 10:09:04 UTC] PHP Notice:  Unable to load class Automattic\Jetpack\Post_List.
Please add the package that contains it using composer and make sure you are requiring the Jetpack autoloader
in /usr/local/src/jetpack-monorepo/projects/packages/config/src/class-config.php on line 129

composer.json and composer.lock are updated into the Jetpack plugin folder, too.

@retrofox Thanks for catching that! I needed to load the class as Automattic\Jetpack\Post_List\Post_List. I've updated the PR and the testing instructions.

@allilevine allilevine removed the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label Sep 17, 2021
@matticbot matticbot added the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label Sep 17, 2021
@allilevine allilevine requested review from retrofox and a team September 17, 2021 15:43
retrofox
retrofox previously approved these changes Sep 20, 2021
Copy link
Contributor

@retrofox retrofox left a comment

Choose a reason for hiding this comment

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

LGTM.
I've tested adding the package to the Jetpack plugins adding the item into the configure method:

public function configure() {
	$config = new Config();

	foreach (
		array(
			'sync',
			'jitm',
			'post_list', // <- new post list added to Jetpack plugin.
		)
		as $feature
	) {
		$config->ensure( $feature );
	}

The package is properly loaded and it shows the image thumbnail.

Just a couple of notes:

Go to http://localhost/wp-admin/edit.php?post-list=true and check that the post thumbnails appear.

It seems we removed the post-list flag from the query string, meaning the feature will be available simply on the http://localhost/wp-admin/edit.php page. Is it correct?

Have we removed the no-thumb image when no thumbnail for the posts?

@retrofox retrofox added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Team Review labels Sep 20, 2021
@retrofox retrofox requested a review from a team September 20, 2021 11:59
@allilevine
Copy link
Member Author

It seems we removed the post-list flag from the query string, meaning the feature will be available simply on the http://localhost/wp-admin/edit.php page. Is it correct?

That's correct! I removed the flag from the testing instructions.

Have we removed the no-thumb image when no thumbnail for the posts?

Looks like it's not showing up anymore. To be addressed here: #20889

@retrofox
Copy link
Contributor

Although we are able to merge it, I'd like to know the opinion of Jetpack folks

@retrofox
Copy link
Contributor

Although we are able to merge it, I'd like to know the opinion of Jetpack folks

@kraftbj @jeherve

@jeherve jeherve added this to the jetpack/10.2 milestone Sep 21, 2021
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Sep 21, 2021
@pablinos
Copy link
Contributor

pablinos commented Sep 21, 2021

It seems we removed the post-list flag from the query string, meaning the feature will be available simply on the http://localhost/wp-admin/edit.php page. Is it correct?

That's correct! I removed the flag from the testing instructions.

Yes, the idea is that the decision of whether to load the package or not should be made by the plugin or wherever it's being used. If we didn't want to load it then we would not include the post-list slug in the packages passed to the ensure method.

@allilevine allilevine merged commit 43d9366 into master Sep 21, 2021
@allilevine allilevine deleted the update/config-class-with-post-list branch September 21, 2021 13:04
@kraftbj kraftbj removed the [Status] Ready to Merge Go ahead, you can push that green button! label Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Package] Config [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Debug Helper Debug Tools plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] VaultPress [Size] XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config Package: Allow for enabling post_list package
6 participants