Skip to content

ActivityPub API: Interaction with remote activities #3510

Description

@mediaformat

What

Interact with remote posts via ActivityPub API:

  • Announce
  • Like
  • Reply
  • Vote

Related #3466

Why

In order to participate with the broader Fediverse, outside of our own posts

How

There seem to be 2 main blockers for interacting with remote posts.

  1. The $result of \apply_filters( 'activitypub_outbox_' will be a WP_Comment with a comment_post_ID of 0
    $parent_comment_id = 0;
    if ( ! empty( $activity['object']['inReplyTo'] ) ) {
    // Regular reply.
    $target_url = object_to_uri( $activity['object']['inReplyTo'] );
    $parent_comment_id = url_to_commentid( $target_url );

    $target_url is not guaranteed to be another comment, so additional checks should search for an ap_post. In the case of an activity fetched via proxy, an ap_post will not be found since it exists only as a transient, so a pre comment hook would be needed to save it as an ap_post.
  2. Outbox::get_by_object_id() will return null for a WP_Comment
    public static function get_by_object_id( $object_id, $activity_type ) {
    $outbox_items = \get_posts(

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions