-
Notifications
You must be signed in to change notification settings - Fork 82
Import Mastodon self-replies as comments #2572
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
Thread continuations (replies to own posts) are now imported as WordPress comments on the parent post, preserving the thread structure. External replies continue to be imported as posts with the reply block. The import now uses a multi-pass approach: - Pass 1: Categorize posts into regular posts and self-replies - Pass 2: Import regular posts (root posts + external replies) as WP posts - Pass 3: Import self-replies as comments, sorted by date for correct threading Self-reply detection compares the actor URL with the inReplyTo URL to determine if a post is a thread continuation. Adds comprehensive tests for self-reply handling including: - Basic self-replies as comments - External replies as posts - Nested thread threading (A → B → C) - Orphaned self-replies handling - Self-replies to external replies
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 enhances the Mastodon importer to intelligently distinguish between self-replies (thread continuations) and external replies, importing the former as WordPress comments while maintaining the latter as posts. This provides a more natural representation of threaded conversations in WordPress.
Key changes:
- Self-replies are now imported as comments on their parent posts instead of separate posts
- Nested self-reply threading is preserved with proper comment parent relationships
- External replies continue to be imported as posts with reply blocks
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| includes/wp-admin/import/class-mastodon.php | Refactored import logic to use a multi-pass approach: categorizing posts, importing regular posts, then importing self-replies as comments with proper threading support |
| tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php | Added comprehensive test coverage for self-reply scenarios including basic self-replies, external replies, nested threading, orphaned replies, and mixed patterns |
| .github/changelog/2572-from-description | Added changelog entry documenting the new feature as a minor addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php
Outdated
Show resolved
Hide resolved
tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php
Outdated
Show resolved
Hide resolved
tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php
Outdated
Show resolved
Hide resolved
tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php
Outdated
Show resolved
Hide resolved
tests/phpunit/tests/includes/wp-admin/import/class-test-mastodon.php
Outdated
Show resolved
Hide resolved
- Fix self-reply detection to prevent false positives with similar usernames - Use more generic "Skipped comments:" message - Add PHP version checks for setAccessible() in tests Co-Authored-By: Claude <[email protected]>
pfefferle
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.
If @TheVoidTLMB is fine with it.
Related to https://wordpress.org/support/topic/import-mastodon-beta/
Proposed changes:
Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Mastodon importer now imports self-replies as comments, preserving thread structure.