Skip to content

Conversation

@obenland
Copy link
Member

@obenland obenland commented Dec 3, 2025

See https://wordpress.org/support/topic/import-mastodon-beta/

Proposed changes:

  • Fix reply block showing empty <div> when oEmbed fails by showing fallback link instead

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Create or import a post with an activitypub/reply block pointing to a URL that has no oEmbed support and returns an error for ActivityPub requests (e.g., https://obenland.it/404)
  • View the post on the frontend
  • Verify the fallback link is shown instead of an empty div

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Reply block now shows fallback link when oEmbed fails instead of empty div.

When a post has `embedPost: true` but both oEmbed and the ActivityPub
fallback fail (e.g., 401 for deleted/private posts), the reply block
now shows a fallback link instead of an empty div.

The fix initializes `$embed` to null before the conditional block and
changes the condition from `if ( ! $show_embed )` to
`if ( ! $show_embed || ! $embed )` so the fallback link displays when
either embed is not requested OR when the embed attempt failed.
Copilot AI review requested due to automatic review settings December 3, 2025 00:11
@obenland obenland self-assigned this Dec 3, 2025
@github-actions github-actions bot added the [Focus] Editor Changes to the ActivityPub experience in the block editor label Dec 3, 2025
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 fixes a bug where the ActivityPub reply block would display an empty <div> element when oEmbed requests fail, by ensuring the fallback link is shown instead.

Key Changes:

  • Modified the reply block rendering logic to check if the embed actually succeeded before deciding whether to show the fallback link
  • Added explicit initialization of the $embed variable to track embed success

Reviewed changes

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

File Description
includes/class-blocks.php Fixed conditional logic to show fallback link when embed fails and initialized $embed variable
.github/changelog/2571-from-description Added changelog entry documenting the bug fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@obenland obenland merged commit d986d14 into trunk Dec 3, 2025
9 checks passed
@obenland obenland deleted the fix/reply-block-empty-embed branch December 3, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Focus] Editor Changes to the ActivityPub experience in the block editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants