Skip to content

Conversation

@pfefferle
Copy link
Owner

The current code seems to parse the nickname, but there is no fallback implemented. This PR tries to fall back to nickname and given-name + family-name if name is empty.

This fixes fed.brid.gy webmentions.

Screenshot 2025-07-09 at 09 33 02

@pfefferle pfefferle self-assigned this Jul 9, 2025
@pfefferle pfefferle requested a review from Copilot July 9, 2025 07:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces fallback logic for the author’s name property: if name is empty it uses nickname, or concatenates given-name + family-name. It also adds new JSON and HTML fixtures to the test suite.

  • Implement fallback for missing name in class-mf2.php
  • Add a basic JSON fixture with author.name
  • Add an HTML fixture containing p-nickname

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/data/mf2/brid-gy-mastodon.json Add minimal JSON fixture for author with name
tests/data/mf2/brid-gy-mastodon.html Add HTML fixture containing author metadata including nickname
includes/Handler/class-mf2.php Implement nickname and given-name/family-name fallback for missing name
Comments suppressed due to low confidence (3)

includes/Handler/class-mf2.php:117

  • Consider updating the method's docblock to document the new fallback behavior for the author name, improving maintainability and clarity for future contributors.
			if ( empty( $author['name'] ) ) {

tests/data/mf2/brid-gy-mastodon.json:1

  • It would be beneficial to add a test fixture where the name property is missing but nickname and/or given-name and family-name are provided, verifying the fallback logic works as expected.
{

tests/data/mf2/brid-gy-mastodon.html:36

  • Consider adding an HTML fixture where the <span class="p-name"> element is absent but p-nickname and/or p-given-name and p-family-name elements are present, to cover fallback parsing in HTML cases.
    <span class="p-nickname">elena</span>

@pfefferle
Copy link
Owner Author

@snarfed fed.brid.gy is really breaking the complete classic webmention mf2 parsing!!

@pfefferle
Copy link
Owner Author

@snarfed can you tell me the target for https://brid.gy/comment/mastodon/@[email protected]/114818746807544274/114818746807544274? is it https://notiz.blog/author/matthias-pfefferle/?

@snarfed
Copy link
Contributor

snarfed commented Jul 9, 2025

Hey @pfefferle, sorry for the trouble! Looks like the target there probably should have been https://notiz.blog/author/matthias-pfefferle/, but we actually sent the webmention with target https://notiz.blog/. Evidently we got confused. Sorry about that!

@pfefferle
Copy link
Owner Author

@snarfed any idea or advice how I can best solve or at least work around this? I get a lot of "broken" Webmentions!

@snarfed
Copy link
Contributor

snarfed commented Oct 16, 2025

Damn, sorry. We made some progress on this recently in snarfed/bridgy#1926 , but still obviously not all the way fixed. Will look more.

@pfefferle
Copy link
Owner Author

No Problem and thanks 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants