Skip to content

Follow Me: Introduce Author Card style #1753

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

Merged
merged 26 commits into from
Jun 5, 2025
Merged

Conversation

obenland
Copy link
Member

@obenland obenland commented May 31, 2025

I've had this improvement in the back of my mind since working on #1691, #1746 just had good timing :)
This PR changes the Button Only mode from being a toggle attribute to becoming a Block Style and adds an Author Card block style, similar to the author card in the New Follower email.

Fixes #1746.
Follow-up to #1691.

Default Button Profile
Screenshot 2025-06-02 at 2 54 32 PM Screenshot 2025-06-02 at 2 54 37 PM Screenshot 2025-06-02 at 3 00 43 PM
Frontend
Screenshot 2025-06-02 at 3 02 52 PM

Proposed changes:

  • Adds rest api field with activitypub context for the user endpoint to make it possible to query post count. The activitypub context makes it the only value returned from these requests and doesn't add it to any other user API requests.
  • Adds setup for block styles in block.json.
  • Adds block deprecation for buttonOnly attribute to convert to block style. Extends it to v1 deprecation.
  • Update Edit component to display all styles and query for additional data, remove Button Only control.
  • Updates render.php to render the full block. Adds button-only style for blocks that have not been upgraded.
  • Updates styles to hide block information based on block style selected.

Testing instructions:

  • Before checking out this branch, create a post with various Follow Me blocks, each with a different configuration.
  • Safe the post and checkout this branch.
  • Check the editor and frontend view of these blocks and make sure backwards compatibility and block deprecations work as expected.
  • Select the profile style for a block and make sure it looks and behaves as expected.
  • Select various users and make sure the block updates correctly.

@obenland obenland self-assigned this May 31, 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 May 31, 2025
@obenland obenland requested a review from Copilot May 31, 2025 20:52
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

This pull request refactors the Follow Me block by replacing the old “buttonOnly” attribute with new style variations and enhancing profile rendering. Key changes include adding a new onModalClose callback in view.js, updating styling in style.scss and block.json, and modifying render and edit logic to depend on block styles rather than the deprecated attribute.

Reviewed Changes

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

Show a summary per file
File Description
src/follow-me/view.js Added JSDoc for a new onModalClose callback.
src/follow-me/style.scss Updated styling with new variations (default, button-only, profile).
src/follow-me/render.php Replaced buttonOnly logic with className-based styling and header image.
src/follow-me/edit.js Removed ToggleControl for buttonOnly; now uses className for styling.
src/follow-me/deprecation.js Introduced migration logic for transitioning from buttonOnly to className.
src/follow-me/block.json Updated version and style definitions to support new design patterns.
includes/class-blocks.php Added a new REST API hook for registering custom fields.
build/* Rebuilt assets with updated styles and scripts.
Comments suppressed due to low confidence (1)

src/follow-me/deprecation.js:57

  • The deprecation logic still depends on 'buttonOnly', while the new block.json now uses 'className' for style differentiation. Consider updating the migration to exclude 'buttonOnly' to fully align with the updated attribute model.
return !! attributes.buttonText || !! attributes.buttonOnly;

@obenland obenland requested a review from Copilot June 2, 2025 19:51
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

This PR introduces an Author Card block style and converts the existing Button Only mode from an attribute toggle into a block style. Key changes include updating JavaScript and PHP rendering logic, revamping SCSS style definitions to support new block styles, and adjusting deprecation logic and block metadata.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/follow-me/view.js Added documentation for onModalClose callback.
src/follow-me/style.scss Updated and extended styles for button-only and profile variations.
src/follow-me/render.php Migrated to block styles and integrated header rendering logic.
src/follow-me/edit.js Removed ToggleControl and updated inspector controls to use className.
src/follow-me/deprecation.js Updated migration code to shift from the buttonOnly attribute to block styles.
src/follow-me/block.json Updated version number and example attributes to reflect new style usage.
includes/class-blocks.php Registered additional REST fields required for the Follow Me block.
build/reactions/render.php Added a parent parameter on button creation.
build/follow-me/* Updated built assets (CSS, JS, PHP templates) to support new styles and version bumps.
Comments suppressed due to low confidence (1)

src/follow-me/edit.js:165

  • Since the 'buttonOnly' toggle control has been removed in favor of block style management via the className attribute, update in-code comments and any related documentation to clearly communicate this change.
<ToggleControl label={ __( 'Button Only Mode', 'activitypub' ) } ... />

@obenland obenland requested a review from pfefferle June 2, 2025 20:21
@obenland obenland marked this pull request as ready for review June 2, 2025 20:21
@obenland obenland added Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. and removed [Status] In Progress labels Jun 3, 2025
@pfefferle
Copy link
Member

@obenland working with JS ;) this has also merge conflicts

@obenland obenland requested a review from pfefferle June 3, 2025 18:12
@pfefferle
Copy link
Member

pfefferle commented Jun 4, 2025

The style breaks if you have no description set.

Screenshot 2025-06-04 at 09 18 55

Update: It seems to look good on some themes, the broken one is "Pulitzer".
Update: The PHP warning (see screenshot below) seems to fix it on some themes 😂. After regenerating the sources, it looks broken on all tested themes.

Aside from that, I see a warning when adding the block to the template.

Screenshot 2025-06-04 at 09 20 42

Might be a missing re-build of the sources??

Update: Fixed with re-bilding sources!

@pfefferle
Copy link
Member

pfefferle commented Jun 4, 2025

This is not directly something specific for this PR (maybe more a general question for all blocks), but because this block can be very dominant, this is where I noticed it the most: The "rounded corner" and "drop-shadow" look is very specific and while testing with several themes that mostly use a "flat design" it feels a lot like a "foreign object".

Can we maybe re-use the styling of the theme or at least use a more decent style (no shadows or rounded corners)?

I think this also mainly applies to the reply-context/embed.

@obenland
Copy link
Member Author

obenland commented Jun 4, 2025

Can we maybe re-use the styling of the theme or at least use a more decent style (no shadows or rounded corners)?

Hm, it's pretty much what this PR is about, to introduce this style of an author card that can be embedded anywhere in the site. It's an extension of the Card style in the Followers block, the onboarding checklist, the author card in the New Follower email, the post preview in the DM and mentions email, and the oembed fallback for Fediverse content.

Dropping the border styling makes the Profile style look quite poor IMO, particularly for profiles with header images.

@pfefferle
Copy link
Member

pfefferle commented Jun 4, 2025

we can add a thin border!?

there is no way to adapt theme styles?

@pfefferle
Copy link
Member

I see the same issue for the preview/embed block. I think the email is different, because it does not integrate in a broader context there.

@obenland obenland requested a review from pfefferle June 4, 2025 15:41
@obenland
Copy link
Member Author

obenland commented Jun 5, 2025

6da39fe might be the way to have our cake and eat it, too. With the border and shadow controls it'll be possible to completely remove or replace the box shadow and rounded corners, providing a consistent default that's completely customizable:

Screen.Recording.2025-06-04.at.7.39.17.PM.mov

Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

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

NICE! ♥️

@obenland obenland merged commit 57c0823 into trunk Jun 5, 2025
11 checks passed
@obenland obenland deleted the update/follow-me-variations branch June 5, 2025 12:31
@openforfuture
Copy link

Awesome! 😻 Pretty close to my mockup (#1746)!

image

It would be even better to have options to:
• Hide the background and description, to make the card more compact.
• Show avatars, similar to the Fediverse reactions block.

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 Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Show follower count (and avatars) in the “Follow on Fediverse” block
3 participants