Skip to content

Follow Me: Improve MU compatibility #1777

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

Open
wants to merge 14 commits into
base: trunk
Choose a base branch
from
Open

Conversation

obenland
Copy link
Member

@obenland obenland commented Jun 6, 2025

Proposed changes:

  • Adds a deprecation handler to update broken Button blocks in Follow Me blocks when users don't have the unfiltered_html capability.
  • Updates variable name for post and follower count to avoid a flash of the follower URL when loading followers.
  • Removes button tagName attribute in favor of the default anchor to account for users that don't have the unfiltered_html capability.
  • Adds call to nodeInfo endpoint to populate post count for blog user.
  • Moves up userOptions check to avoid showing an empty options panel when there is only one user.

Other information:

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

Testing instructions:

  • Insert a Follow Me block in the editor and save.
  • In the frontend, make sure the Follow button still opens the modal.
  • Switch to Blog only mode on your site.
  • Update the Follow Me block and make sure there is no user selector in the sidebar.
  • Double check that it shows the correct amount of posts in the editor and the front end.

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

Avoids the button block breaking for users that don't have the unfiltered_html capability.
Blog users now get their correct post count displayed in the Editor and the front-end.

@obenland obenland self-assigned this Jun 6, 2025
@github-actions github-actions bot added [Block] Follow Me [Focus] Editor Changes to the ActivityPub experience in the block editor [Status] In Progress labels Jun 6, 2025
@obenland obenland marked this pull request as ready for review June 6, 2025 16:53
@obenland obenland requested review from pfefferle and Copilot and removed request for pfefferle June 6, 2025 16:53
Copy link

@Copilot 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

Improves the Follow Me block’s behavior for users without the unfiltered_html capability, correctly migrates broken button inner blocks, and ensures accurate post/follower counts.

  • Adds a deprecation handler to migrate button-only blocks when HTML is stripped
  • Renames stats properties to postsCount/followersCount, removes custom tagName, and fetches site-wide post counts via the NodeInfo endpoint
  • Refactors InspectorControls to hide the panel when only one user is available and bumps block version

Reviewed Changes

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

File Description
src/follow-me/render.php Use site-wide post count when userId is zero
src/follow-me/edit.js Rename stats keys, remove tagName, add NodeInfo fetch, update controls
src/follow-me/deprecation.js Add v3 migration for stripped button HTML
src/follow-me/block.json Bump version from 2.1.0 to 2.2.0

@obenland obenland marked this pull request as draft June 6, 2025 18:54
@obenland
Copy link
Member Author

obenland commented Jun 6, 2025

This is still not working quite right

@obenland obenland marked this pull request as ready for review June 6, 2025 19:15
@obenland
Copy link
Member Author

obenland commented Jun 6, 2025

Back in business! The deprecation now converts all buttons to anchors, even if they don't error, and they behave more like buttons in the front-end, including keyboard navigation

@pfefferle
Copy link
Member

Is this the way to go in terms of accessibility? Do we have to at least add role="button"??

@obenland
Copy link
Member Author

obenland commented Jun 6, 2025

I did add it here.

And no, it is not. But it's either turning the button into an anchor, or the block breaking for everyone who doesn't have the unfiltered_html cap. Which I'd also be fine with, if that's what we want to do. We could just remove the block from the inserter for everyone who doesn't have the cap.

@obenland
Copy link
Member Author

obenland commented Jun 8, 2025

We could also save it as an anchor, then render it as a button in the front-end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Follow Me [Focus] Editor Changes to the ActivityPub experience in the block editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants