Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Introduce new `wpl_iframe_src` filter to enable filtering arguments to Likes iframes. #40276

Open georgestephanis opened 1 day ago

georgestephanis commented 1 day ago

This will enable experimenting with re-introducing slim likeboxes to display likes without gravatars and other future changes. Could also enable testing grounds of new changes before full UI for setting management is built out, or potentially to point more easily to a testing sandbox.

Companion to proposed changes WPCOM-side via phab diff D165404

I used the existing pattern of wpl_ for the filter prefix but I'm 100% fine if it's changed to jetpack_likes_ for a filter prefix or anything else.

Proposed changes:

Other information:

Jetpack product discussion

I've been discussing this with @jsnajdr in Slack about the wpcom-side changes. Jetpack-side changes for now are limited to just adding two filters so it is possible to append a slim=1 argument.

Slim mode was added for the Carousel module eleven years ago, and removed again eight years ago via #3585 but the code supporting it has lived on wpcom-side, albeit in a broken state for the past few years. The proposed change wpcom-side rectifies that and lets slim mode work again as a version without gravatars. This PR to Jetpack just makes it possible to filter and append the iframe to add &slim=1 to the fragment so JS picks it up and toggles the mode.

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

Testing instructions:

github-actions[bot] commented 1 day ago

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

Interested in more tips and information?

github-actions[bot] commented 1 day ago

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

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 :robot:


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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Jetpack plugin:

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

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

georgestephanis commented 1 day ago

Setting up the Jetpack CLI tool isn't functional for me currently.

I've tried to follow the directions as best I could, but it seems pnpm is installing a version newer than Jetpack supports currently to generate the changelog message?

~/code/jetpack $ pnpm -v
9.14.2
~/code/jetpack $ pnpm install
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your pnpm version is incompatible with "/Users/georgestephanis/code/jetpack".

Expected version: ^9.3.0 <9.12.0
Got: 9.14.2

This is happening because the package's manifest has an engines.pnpm field specified.
To fix this issue, install the required pnpm version globally.

To install the latest version of pnpm, run "pnpm i -g pnpm".
To check your pnpm version, run "pnpm -v".
georgestephanis commented 1 day ago

I've tried to follow the directions as best I could, but it seems pnpm is installing a version newer than Jetpack supports currently to generate the changelog message?

I sorted this locally with the following change --

diff --git a/package.json b/package.json
index 347afccb62..bf8194e99f 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
    },
    "engines": {
        "node": "^22.9.0",
-       "pnpm": "^9.3.0 <9.12.0"
+       "pnpm": "^9.3.0 <9.15.0"
    },
    "packageManager": "pnpm@9.3.0"
 }

Unsure if pnpm needs to have a max version required in package.json?

simison commented 1 day ago

npm i -g pnpm@9.12.0 helped me in a similar situation.

simison commented 1 day ago

What are some other changes that you're looking into with Likes?

It would be important to have a path with these types of settings configurable in the Likes Block.

georgestephanis commented 1 day ago

What are some other changes that you're looking into with Likes?

Just what's outlined in the phab diff. Getting the "slim" mode up and running again, and retooling it to operate as the current full likes block behaves, but without gravatars.

Longer term, I'd like to have to have that potentially available as a setting for the likes button exposed to admins -- whether or not to display gravatars of users who have liked it -- but I'm personally fine with that resolving down the road following any discussion / bikeshedding on whether to include it is finalized.