Skip to content

Commit

Permalink
Social Notes: add support for the ActivityPub reply-to block when the…
Browse files Browse the repository at this point in the history
… plugin is present (#39738)
  • Loading branch information
kraftbj authored Oct 11, 2024
1 parent bf52578 commit 31444d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Social Notes: add support for the ActivityPub Reply-To block.
26 changes: 25 additions & 1 deletion projects/plugins/social/src/class-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Automattic\Jetpack\Social;

use Automattic\Jetpack\Constants;

/**
* Register the Jetpack Social Note custom post type.
*/
Expand All @@ -31,6 +33,19 @@ public function init() {
}
add_filter( 'allowed_block_types', array( $this, 'restrict_blocks_for_social_note' ), 10, 2 );

/*
* The ActivityPub plugin has a block to set a Fediverse post that a new post is in reply to. This is perfect for Social Notes.
*/
if ( Constants::get_constant( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) {
add_filter(
'jetpack_social_allowed_blocks',
function ( $allowed_blocks ) {
$allowed_blocks[] = 'activitypub/reply';
return $allowed_blocks;
}
);
}

self::register_cpt();
add_action( 'wp_insert_post_data', array( $this, 'set_empty_title' ), 10, 2 );
add_action( 'admin_init', array( $this, 'admin_init_actions' ) );
Expand Down Expand Up @@ -148,7 +163,16 @@ public function restrict_blocks_for_social_note( $allowed_blocks, $post ) {
);
}

return $allowed_blocks;
/**
* Filters the blocks available to the Social Notes CPT.
*
* Default is ['core/paragraph', 'core/post-featured-image']
*
* @since $$next-version$$
*
* @param array $allowed_blocks A linear array of blocks allowed by the CPT.
*/
return apply_filters( 'jetpack_social_allowed_blocks', $allowed_blocks );
}

/**
Expand Down

0 comments on commit 31444d0

Please sign in to comment.