Skip to content

Add support for Mastodon FeaturedCollection import#3168

Merged
pfefferle merged 5 commits into
trunkfrom
add/featured-collection-import-support
Apr 13, 2026
Merged

Add support for Mastodon FeaturedCollection import#3168
pfefferle merged 5 commits into
trunkfrom
add/featured-collection-import-support

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Proposed changes:

  • Add FeaturedItem type handling to object_to_uri() so the Starter Kit importer transparently supports both the Pixelfed starter-kit format and the Mastodon FEP FeaturedCollection format.
  • Validate collection type on import (accepts Collection, OrderedCollection, and FeaturedCollection, including multi-type arrays).
  • Resolve images via object_to_uri() for format-agnostic URL extraction (handles both { "url": "..." } and { "url": { "type": "Link", "href": "..." } }).
  • Show actor display names when available in the import selection UI.

Other information:

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

Testing instructions:

  • Import a Pixelfed-format starter kit JSON (with type: Collection and Person items) — should work as before.
  • Import a Mastodon FEP-format starter kit JSON (with type: FeaturedCollection and FeaturedItem entries containing featuredObject) — actors should be correctly extracted and listed.
  • Try importing a JSON file with an invalid type (e.g. Note) — should show an error message.
  • Verify actor names display as Name (URI) when available, and as plain URIs when not.

Changelog entry

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

Significance

  • Patch

Type

  • Added - for new features

Message

Add support for importing Starter Packs in both the Pixelfed and Mastodon formats.

Add FeaturedItem handling to object_to_uri() so the Starter Kit
importer can process both the Pixelfed starter-kit format and the
Mastodon FEP FeaturedCollection format transparently.

Also validates collection type on import, resolves images via
object_to_uri() for format-agnostic URL extraction, and shows
actor display names when available in the import UI.
@pfefferle pfefferle self-assigned this Apr 13, 2026
@pfefferle pfefferle requested review from a team and Copilot April 13, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for importing Starter Packs in both Pixelfed “starter-kit” and Mastodon FEP “FeaturedCollection” formats, including FeaturedItem handling and improved UI output.

Changes:

  • Extend object_to_uri() to resolve Mastodon FeaturedItem objects.
  • Validate imported JSON type as a Collection-like type (supports multi-type arrays).
  • Make image URL extraction format-agnostic and show actor display names in the selection UI.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/phpunit/tests/includes/class-test-functions-activity.php Adds test cases for FeaturedItem URI extraction.
includes/wp-admin/import/class-starter-kit.php Updates importer UI (image + actor display name) and validates starter kit collection types.
includes/functions-activity.php Adds FeaturedItem handling in object_to_uri().
.github/changelog/3168-from-description Adds changelog entry for the new import support.

Comment thread includes/functions-activity.php Outdated
Comment thread includes/functions-activity.php
Comment thread includes/wp-admin/import/class-starter-kit.php Outdated
@pfefferle pfefferle requested a review from jeherve April 13, 2026 13:59
Fall back to url, then href, then null when an object has no id
property. This prevents PHP notices when processing objects like
images that may only have a url or href.
The test expected a PHP notice when actor has no id field. Now that
object_to_uri() returns null gracefully instead of triggering a
notice, the test asserts the correct behavior: not blocked.
@pfefferle pfefferle merged commit 094e9cc into trunk Apr 13, 2026
10 checks passed
@pfefferle pfefferle deleted the add/featured-collection-import-support branch April 13, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants