Skip to content

Conversation

@jeherve
Copy link
Member

@jeherve jeherve commented Jan 4, 2023

Changes proposed in this Pull Request:

Up until now, social menu items would only rely on host names (e.g. amazon.fr) to detect whether a specific menu item should use a specific icon.
This works well, but isn't very flexible. It's especially problematic for services that typically either have lots of different TLDs, or services that use different domain names.

With this commit, you should now be able to provide either a host name, just like before and ensuring backwards compatibility for folks who have customized that feature on their end, as well as regex for more advanced matching.

In future PRs, I'm hoping to use this new flexibility to add support for more services.

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

  • N/A

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

  • No

Testing instructions:

  • Start by switching to an old theme on your site, like Twenty Ten.
  • In a functionality plugin, add the following code snippet:
// Add social menu support
add_action( 'after_setup_theme', function () {
	add_theme_support( 'jetpack-social-menu', 'svg' );
} );
  • Go to Appearance > Menus, and create a new menu.
  • In that menu, add a few custom links pointing to different services supported by Jetpack: Twitter, Strava, ..., and an Amazon link of your choice. Also add an unsupported service, like a link to jetpack.com for example.
  • After saving your menu, assign it to the Social Menu location.
  • Save your changes.
  • Visit the site's frontend and check the look of the menu.

Up until now, social menu items would only rely on host names (e.g. amazon.fr) to detect whether a specific menu item should use a specific icon.
This works well, but isn't very flexible. It's especially problematic for services that typically either have lots of different TLDs, or services that use different domain names.

With this commit, you should now be able to provide either a host name, just like before and ensuring backwards compatibility for folks who have customized that feature on their end, as well as regex for more advanced matching.
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Theme Tools [Status] Needs Review This PR is ready for review. [Pri] Normal labels Jan 4, 2023
@jeherve jeherve self-assigned this Jan 4, 2023
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Jan 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

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

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run bin/jetpack-downloader test jetpack add/social-menu-add-regex-option to get started. More details: p9dueE-5Nn-p2

@jeherve jeherve enabled auto-merge (squash) January 4, 2023 17:25
jeherve added a commit that referenced this pull request Jan 4, 2023
Fixes #10338

This is a first implementation, that we can revisit once #28172 is merged.

For now, it detects some of the most popular instances of Mastodon (pulled from https://instances.social/ plus a few others that I know are popular in the WordPress community) and uses the Mastodon icon there.

It's not perfect since we cannot possibly detect all instances of Mastodon, but that's a start.
@sergeymitr sergeymitr added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Jan 4, 2023
@jeherve jeherve added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jan 5, 2023
Copy link
Contributor

@sergeymitr sergeymitr left a comment

Choose a reason for hiding this comment

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

Tests well 👍

@sergeymitr sergeymitr 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 Jan 5, 2023
@jeherve jeherve merged commit cee6555 into trunk Jan 5, 2023
@jeherve jeherve deleted the add/social-menu-add-regex-option branch January 5, 2023 21:36
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Theme Tools [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants