Add pre-publish panel suggesting post formats for federation#2971
Open
Add pre-publish panel suggesting post formats for federation#2971
Conversation
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
There was a problem hiding this comment.
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.objectTypeand_activityPubOptions.noteLengthfrom 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2903
Proposed changes:
objectTypeandnoteLengthfrom PHP to the editor JS via_activityPubOptions.ACTIVITYPUB_NOTE_LENGTHdefault from 400 to 500 characters.src/pre-publish-panel/package with detection utilities, component, and tests.Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Add a pre-publish suggestion that recommends a post format for better compatibility with media-focused Fediverse platforms.