- Notifications
You must be signed in to change notification settings - Fork 83
Add Extra Fields block for ActivityPub profiles #2439
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
Conversation
Introduces a new 'Fediverse Profile Fields' block to display extra profile fields from ActivityPub user profiles. Includes block registration, editor and server-side rendering logic, styles for default, compact, and cards layouts, and integration into the block registration process.
There was a problem hiding this 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 a new "Fediverse Profile Fields" block that displays extra profile fields from ActivityPub user profiles. The block provides three style variants (default, compact, and cards) with extensive customization options including colors, borders, typography, and field limits.
Key Changes:
- New block implementation with server-side rendering for displaying ActivityPub profile fields
- Three visual style variations: default (vertical list), compact (table-like), and cards (individual styled cards)
- User selection dropdown with support for blog user, specific users, and dynamic/inherit mode
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/extra-fields/block.json | Block metadata defining attributes, styles, and supported features |
src/extra-fields/edit.js | Editor component with API fetch logic and preview rendering |
src/extra-fields/save.js | Save function returning null (uses server-side rendering) |
src/extra-fields/render.php | Server-side rendering template with field filtering and styling |
src/extra-fields/style.scss | Styles for all three block variations with responsive layouts |
src/extra-fields/index.js | Block registration entry point |
includes/class-blocks.php | Registers the new block in the plugin's block registration process |
build/extra-fields/* | Compiled production files (CSS, JS, PHP) from source files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduces a PHP docblock for the render callback in src/extra-fields/render.php, clarifying the types and purpose of the $attributes and $block variables for improved code readability and maintainability.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Introduces comprehensive Jest tests for the Extra Fields block edit component. Refines card and compact styles to use CSS variables for colors and removes unnecessary width properties. Updates PHP render logic to pass block context for user resolution and improves key usage in React field rendering.
Simplifies the Extra Fields block render callback by removing the unused $block->context argument from Blocks::get_user_id. This change clarifies the function call and eliminates unnecessary code.
Introduces unit tests for the Activitypub Extra Fields block, covering rendering for blog and user contexts, maxFields attribute, empty fields, cards style, background color, and HTML content preservation. Enhances test coverage for block functionality and edge cases.
Enhanced the logic for detecting the post author in the Extra Fields block, including support for Query Loop context. Inspector controls are now always rendered, even when no author is present in inherit mode, improving recovery and usability. Added tests for context-based author detection and updated PHP render logic to skip output for ActivityPub requests and feeds.
Updated SCSS and built CSS files to style <p> elements within .activitypub-extra-field dd, ensuring proper spacing and removing bottom margin from the last paragraph. This improves readability and consistency for extra field content.
| @pfefferle Is this meant for 7.6.0? |
| @obenland no, I don't think so! |
Updated block title, description, and UI labels from 'Fediverse Profile Fields' to 'Fediverse Extra Fields' for clarity. CSS class names and references in JS were also changed to match the new naming convention.
Changed the default block style from 'default' to 'compact', renamed the previous 'compact' style to 'stacked', and updated related CSS/SCSS to support the new naming and layout. This improves clarity and consistency in style options for the Fediverse Extra Fields block.
| @obenland "Compact" is now the default and the former default is now called "Stacked". |
Consolidates block save logic by removing the unused save.js file and updating registration to use an inline save function returning null. Refactors CSS and SCSS for the extra fields block to make the default style compact (table layout), and adjusts stacked and card styles for consistency. Adds support for a configurable namespace in API requests.
The extra fields block now displays a link to the appropriate profile settings page when no extra fields are found, based on user type. Error messages are improved with sprintf for translation, and the block UI is updated to remove unused icons. ActivityPub options now include profile URLs for both user and blog types.
Added mocks for sprintf, Button, and useOptions to improve test coverage. Split the empty fields message into two separate assertions for clarity.
obenland left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably good enough for now. It would be nice to have more custimzeability, maybe a nicer loading state, keeping queried data stored for the session, etc, but this works.

Introduces a new 'Fediverse Profile Fields' block to display extra profile fields from ActivityPub user profiles. Includes block registration, editor and server-side rendering logic, styles for default, compact, and cards layouts, and integration into the block registration process.
Styles:
Settings:
Proposed changes:
Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Added a new Fediverse Profile Fields block to display ActivityPub profile details, featuring default, compact, and card layouts with flexible user selection options.