Handle the public collection and address activities
This commit is contained in:
parent
a12ea89f92
commit
914dd137a5
@ -21,6 +21,11 @@ function handle_post_status_change( $new_status, $old_status, $post ) {
|
||||
$activity = \activities\delete\make_delete( $actor_slug, $post_object );
|
||||
}
|
||||
if ( $activity && ! is_wp_error( $activity ) ) {
|
||||
$followers = \followers\get_followers_collection( $actor_slug );
|
||||
$activity['to'] = array(
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
$followers['id']
|
||||
);
|
||||
$server = rest_get_server();
|
||||
$request = \WP_REST_Request::from_url( $actor_outbox );
|
||||
$request->set_method('POST');
|
||||
|
@ -51,6 +51,9 @@ a single object id (url), or an array of object ids. If it's a url, it
|
||||
should dereference to one of the above types
|
||||
*/
|
||||
function get_recipient_urls( $object, $depth, $acc ) {
|
||||
if ( $object === 'https://www.w3.org/ns/activitystreams#Public' ) {
|
||||
return array( $object );
|
||||
}
|
||||
if ( $depth === 30 ) {
|
||||
return $acc;
|
||||
}
|
||||
@ -118,6 +121,9 @@ function get_recipient_urls( $object, $depth, $acc ) {
|
||||
|
||||
function post_activity_to_inboxes( $actor_id, $activity, $recipients ) {
|
||||
foreach ( $recipients as $inbox ) {
|
||||
if ( $inbox === 'https://www.w3.org/ns/activitystreams#Public' ) {
|
||||
continue;
|
||||
}
|
||||
if ( \util\is_local_url( $inbox ) ) {
|
||||
$request = \WP_REST_Request::from_url( $inbox );
|
||||
$request->set_method('POST');
|
||||
|
Loading…
Reference in New Issue
Block a user