updated plugin ActivityPub version 8.3.0

This commit is contained in:
2026-06-03 21:28:46 +00:00
committed by Gitium
parent a4b78ec277
commit 6fe182458a
340 changed files with 43232 additions and 7568 deletions

View File

@ -7,8 +7,10 @@
namespace Activitypub\Scheduler;
use Activitypub\Activity\Activity;
use Activitypub\Collection\Actors;
use Activitypub\Collection\Extra_Fields;
use Activitypub\Collection\Outbox;
use function Activitypub\add_to_outbox;
use function Activitypub\is_user_type_disabled;
@ -48,6 +50,13 @@ class Actor {
\add_action( 'update_option_activitypub_actor_mode', array( self::class, 'blog_user_update' ) );
\add_action( 'transition_post_status', array( self::class, 'schedule_post_activity' ), 33, 3 );
\add_action( 'post_stuck', array( self::class, 'sticky_post_update' ) );
\add_action( 'post_unstuck', array( self::class, 'sticky_post_update' ) );
// User deletion handling.
\add_action( 'delete_user', array( self::class, 'schedule_user_delete' ), 10, 3 );
\add_filter( 'post_types_to_delete_with_user', array( self::class, 'post_types_to_delete_with_user' ) );
}
/**
@ -143,4 +152,53 @@ class Actor {
add_to_outbox( $actor, 'Update', $user_id );
}
/**
* Send a profile update when a post's sticky status changes.
*
* @param int $post_id The post ID.
*/
public static function sticky_post_update( $post_id ) {
$post = \get_post( $post_id );
if ( ! $post ) {
return;
}
self::schedule_profile_update( $post->post_author );
}
/**
* Schedule a Delete activity when a user is deleted.
*
* @param int $user_id The user ID being deleted.
*/
public static function schedule_user_delete( $user_id ) {
// Get the actor before deletion to ensure we have the data.
$actor = Actors::get_by_id( $user_id );
if ( \is_wp_error( $actor ) ) {
return;
}
$activity = new Activity();
$activity->set_actor( $actor->get_id() );
$activity->set_object( $actor->get_id() );
$activity->set_type( 'Delete' );
add_to_outbox( $activity, null, $user_id );
}
/**
* Remove outbox from post types to delete with user.
*
* Outbox items should not be deleted with the user, because we
* need to federate the `Delete` Activities.
*
* @param array $post_types The post types to delete with user.
*
* @return array The post types to delete with user without outbox.
*/
public static function post_types_to_delete_with_user( $post_types ) {
return \array_diff( $post_types, array( Outbox::POST_TYPE ) );
}
}