Skip to content

Conversation

@pfefferle
Copy link
Member

@pfefferle pfefferle commented Oct 17, 2025

Introduces a new 'quote' comment type, updates interaction handling to extract and process quote links from content, and enhances reply detection to recognize quote-inline patterns. Includes comprehensive tests for quote extraction and reply identification.

Screenshot 2025-11-05 at 15 24 55

supersedes #2303

Proposed changes:

  • Adds a new 'quote' comment type with appropriate metadata and translations
  • Implements quote link extraction from HTML content with regex pattern matching
  • Enhances reply detection to recognize quote-inline patterns in addition to standard inReplyTo properties

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 support for quote comments, improving detection and handling of quoted replies and links in post interactions.

Introduces a new 'quote' comment type, updates interaction handling to extract and process quote links from content, and enhances reply detection to recognize quote-inline patterns. Includes comprehensive tests for quote extraction and reply identification.
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 support for quote comments in the ActivityPub plugin by adding detection and handling of quote-inline patterns commonly used by Mastodon and other Fediverse platforms. It enhances the reply detection system to recognize quote patterns and processes them as a new comment type.

  • Adds a new 'quote' comment type with appropriate metadata and translations
  • Implements quote link extraction from HTML content with regex pattern matching
  • Enhances reply detection to recognize quote-inline patterns in addition to standard inReplyTo properties

Reviewed Changes

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

Show a summary per file
File Description
tests/phpunit/tests/includes/collection/class-test-interactions.php Adds comprehensive tests for quote link extraction and quote comment creation
tests/phpunit/tests/includes/class-test-functions.php Adds tests for enhanced reply detection including quote-inline pattern recognition
includes/functions.php Updates is_activity_reply function to detect quote-inline patterns
includes/collection/class-interactions.php Implements extract_quote_link method and integrates quote handling into comment creation
includes/class-comment.php Registers new 'quote' comment type and updates descriptions for existing comment types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

pfefferle and others added 4 commits October 17, 2025 15:17
Split the validation in add_comment() to separately check for valid comment data and the presence of 'inReplyTo'. This improves code clarity and ensures early return if comment data is invalid.
Introduces a 'display_style' property to comment type definitions, distinguishing between 'facepile' and 'comment' display styles. Adds helper methods to check if a comment type should be shown as a facepile and to retrieve all facepile types, enabling more flexible comment rendering.
@Jiwoon-Kim
Copy link
Contributor

Jiwoon-Kim commented Oct 17, 2025

What do you think of this idea?

When a QuoteRequest activity is received, it’s stored in the wp_comment table with comment_type=QuoteRequest and comment_status=moderated.
When the comment is approved, an Accept activity is triggered.
This method is also used to display the quote count.

In the case of Misskey quotes, when the quoteUri property exists, it indicates that the post has been quoted — however, it isn’t reflected in the quote count.

https://docs.akkoma.dev/stable/development/ap_extensions/#quote-posts

Old Misskey only understood and modern Misskey still prefers the _misskey_quote property for this. Similar some other older software used quoteUrl or quoteURL.
All current implementations with quote support understand quoteUri.

To quote a Misskey note in WordPress, the quoteUri property must be supported.
Since FEP-044f has been implemented, notifications can be received when detected, but quoting is not possible.

@pfefferle
Copy link
Member Author

https://mastodon.social/@pfefferle/115405195331557281

@pfefferle pfefferle changed the title Add support for quote comments and improve quote detection Add support for quote reactions and improve quote detection Oct 22, 2025
@pfefferle
Copy link
Member Author

Close it for now and see how the Reader might help.

Eliminated the 'display_style' property from comment type definitions and removed related methods for determining and retrieving facepile types. This simplifies comment type handling by no longer distinguishing between facepile and comment display styles.
Introduces comprehensive PHPUnit tests for the esc_hashtag function, including a data provider with various input cases, filter hook behavior, HTML escaping, and handling of quoted strings. These tests ensure correct hashtag formatting, proper escaping, and extensibility via filters.
pfefferle and others added 5 commits November 10, 2025 15:57
Introduces getter and setter methods for quote, quoteUrl, quoteUri, and _misskey_quote properties to support FEP-044f and platform-specific quoting features.
Replaces the use of the translation function for 'description' fields in activity types (Reposts, Likes, Quotes) with plain strings. This change may be intended to simplify or standardize these descriptions, possibly because translation is not needed for these fields.
@pfefferle
Copy link
Member Author

@obenland forgot to add the new attributes, that's why they were not added to the inbox. I changed the code to work with the quote attribute (and fallbacks).

@pfefferle pfefferle requested a review from Copilot November 10, 2025 15:05
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Corrects the condition for converting camelCase to snake_case in Generic_Object by checking for underscore prefix using str_starts_with. Adds and expands PHPUnit tests for handling quote and underscore-prefixed properties in Base_Object, including round-trip set/get tests.
Refactored the function is_activity_quote to is_quote_activity for improved naming consistency. Updated all references and related tests to use the new function name.
Corrects the condition to convert camelCase to snake_case only for keys not prefixed with '_', ensuring proper key formatting in the Generic_Object class.
Changed @Covers annotations in class-test-generic-object.php to use the fully qualified class name Activitypub\Activity\Generic_Object for improved clarity and accuracy in test coverage reporting.
Copilot finished reviewing on behalf of pfefferle November 11, 2025 08:25
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

obenland
obenland previously approved these changes Nov 11, 2025
The 'quote' comment type is now included alongside 'like' and 'repost' in the Jetpack integration. This expands supported ActivityPub comment types.
@github-actions github-actions bot added the [Focus] Compatibility Ensuring the plugin plays well with other plugins label Nov 11, 2025
@pfefferle pfefferle requested a review from obenland November 13, 2025 17:25
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.

5 participants