Skip to content

Add pre-publish panel suggesting post formats for federation#2971

Open
pfefferle wants to merge 6 commits intotrunkfrom
add/pre-publish-post-format-suggestion
Open

Add pre-publish panel suggesting post formats for federation#2971
pfefferle wants to merge 6 commits intotrunkfrom
add/pre-publish-post-format-suggestion

Conversation

@pfefferle
Copy link
Member

@pfefferle pfefferle commented Feb 24, 2026

Fixes #2903

Screenshot 2026-02-24 at 13 43 03

Proposed changes:

  • Add a pre-publish panel that analyzes post content and suggests a better post format when the object type setting is "Post Format". This helps image/video/audio posts get shared as Notes instead of Articles, making them visible on media-focused platforms like Pixelfed and Vernissage.
  • Pass objectType and noteLength from PHP to the editor JS via _activityPubOptions.
  • Raise ACTIVITYPUB_NOTE_LENGTH default from 400 to 500 characters.
  • New src/pre-publish-panel/ package with detection utilities, component, and tests.

Other information:

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

Testing instructions:

  • Go to Settings → ActivityPub and set "Object Type" to "Post Format" (this is the default).
  • Create a new post in the block editor.
  • Add an image block (or gallery, video, audio) with a short caption.
  • Click "Publish" — the pre-publish panel should show a "Fediverse ⁂" section suggesting the appropriate format (e.g., Image, Gallery).
  • Click the "Set format to Image" button — the suggestion disappears as the format is applied.
  • Verify that long text-only posts (>500 chars) do not trigger a suggestion.
  • Verify that posts with an explicitly set post format do not trigger a suggestion.

Changelog entry

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

Significance

  • Minor

Type

  • Added - for new features

Message

Add a pre-publish suggestion that recommends a post format for better compatibility with media-focused Fediverse platforms.

When the object type setting is "Post Format", analyze post content
and suggest a more appropriate format (Image, Gallery, Video, Audio,
Status) before publishing. This helps image/video posts get shared
as Notes instead of Articles, making them visible on media-focused
platforms like Pixelfed and Vernissage.

Also raises ACTIVITYPUB_NOTE_LENGTH from 400 to 500 and passes
objectType and noteLength to the editor JS.

Ref #2903
Copilot AI review requested due to automatic review settings February 24, 2026 12:46
@pfefferle pfefferle self-assigned this Feb 24, 2026
@pfefferle pfefferle requested a review from a team February 24, 2026 12:46
@github-actions github-actions bot added the [Focus] Editor Changes to the ActivityPub experience in the block editor label Feb 24, 2026
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

Adds a block-editor pre-publish panel that inspects post blocks and suggests a more suitable post format (e.g., Image/Gallery/Video/Audio/Status) when ActivityPub is configured to map object types via post formats, improving federation visibility on media-first platforms.

Changes:

  • Introduce src/pre-publish-panel/ with block analysis utilities, a pre-publish UI plugin, and Jest tests.
  • Pass _activityPubOptions.objectType and _activityPubOptions.noteLength from PHP to editor JS; increase default note length to 500.
  • Enqueue the new pre-publish panel script and add build artifacts + changelog entry.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/pre-publish-panel/utils.js Adds block-content analysis and post-format suggestion logic.
src/pre-publish-panel/plugin.js Registers the pre-publish panel UI and applies a suggested format via editPost.
src/pre-publish-panel/block.json Provides metadata used by the build/editorScript pipeline for the panel package.
src/pre-publish-panel/__tests__/plugin.test.js Adds Jest coverage for block analysis and suggestion behavior.
includes/constants.php Updates ACTIVITYPUB_NOTE_LENGTH default to 500.
includes/class-blocks.php Exposes options to JS and enqueues the pre-publish panel bundle.
build/pre-publish-panel/* Adds built JS and asset metadata for production.
.github/changelog/2971-from-description Documents the feature addition.

Replaces manual regex with the same utility used elsewhere in the
codebase. Fixes CodeQL incomplete-sanitization warning.
- Move textBlockNames/galleryBlockNames to module-level constants.
- Fix core/pullquote to read from `value` attribute instead of `content`.
- Reorder priority: video/audio now suggested before single image to
  avoid incorrect recommendations for mixed-media posts.
- Fix grammar in video/audio suggestion messages.
- Add tests for mixed-media priority (image+video, image+audio).
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.

Improve detection and signaling of image-focused posts for federation

3 participants