Skip to content

Conversation

@pfefferle
Copy link
Member

@pfefferle pfefferle commented Nov 11, 2025

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:

 Screenshot 2025-11-11 at 12 52 51  Screenshot 2025-11-11 at 12 52 41 Screenshot 2025-11-11 at 12 52 08
Default Cards Compact

Settings:

Screenshot 2025-11-11 at 12 52 26 Screenshot 2025-11-11 at 12 52 21

Proposed 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

Other information:

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

Testing instructions:

  • Go to '..'

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

Added a new Fediverse Profile Fields block to display ActivityPub profile details, featuring default, compact, and card layouts with flexible user selection options.

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.
@pfefferle pfefferle self-assigned this Nov 11, 2025
Copilot AI review requested due to automatic review settings November 11, 2025 11:56
@github-actions github-actions bot added the [Focus] Editor Changes to the ActivityPub experience in the block editor label Nov 11, 2025
Copilot finished reviewing on behalf of pfefferle November 11, 2025 12:00
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 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.

pfefferle and others added 7 commits November 11, 2025 13:05
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.
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.
@pfefferle pfefferle requested a review from obenland November 11, 2025 12:15
matticbot and others added 2 commits November 11, 2025 14:15
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.
@obenland
Copy link
Member

@pfefferle Is this meant for 7.6.0?

@pfefferle
Copy link
Member Author

@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.
@pfefferle
Copy link
Member Author

@obenland "Compact" is now the default and the former default is now called "Stacked".

Screenshot 2025-11-13 at 18 21 39

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.
@pfefferle pfefferle requested a review from obenland November 14, 2025 08:08
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 [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants