Compact actor before delivery; improve excerpt generation
This commit is contained in:
parent
6a8a3fed3b
commit
02fe7d600a
@ -48,14 +48,11 @@ function post_to_object( $post ) {
|
||||
return;
|
||||
}
|
||||
setup_postdata( $post );
|
||||
$GLOBALS['post'] = $post;
|
||||
$permalink = get_permalink( $post );
|
||||
$summary = null;
|
||||
if ( $post->post_content ) {
|
||||
$summary = \html_entity_decode(
|
||||
get_the_excerpt( $post ),
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
$summary = apply_filters( 'get_the_excerpt', get_post_field( 'post_excerpt', $post->ID ) );
|
||||
}
|
||||
$matches = array();
|
||||
if ( preg_match( '/(.+)__trashed\/$/', $permalink, $matches ) ) {
|
||||
|
@ -102,7 +102,7 @@ function make_create( $actor_slug, $object ) {
|
||||
$activity = array(
|
||||
'@context' => array( 'https://www.w3.org/ns/activitystreams' ),
|
||||
'type' => 'Create',
|
||||
'actor' => $actor,
|
||||
'actor' => $actor['id'],
|
||||
'object' => $object
|
||||
);
|
||||
return $activity;
|
||||
|
@ -92,7 +92,7 @@ function make_delete( $actor_slug, $object ) {
|
||||
return array(
|
||||
'@context' => array( 'https://www.w3.org/ns/activitystreams' ),
|
||||
'type' => 'Delete',
|
||||
'actor' => $actor,
|
||||
'actor' => $actor['id'],
|
||||
'object' => $object
|
||||
);
|
||||
}
|
||||
|
@ -79,10 +79,11 @@ function make_accept( $actor_slug, $follow ) {
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
$actor = \pterotype\actors\get_actor_by_slug( $actor_slug );
|
||||
$accept = array(
|
||||
'@context' => array( 'https://www.w3.org/ns/activitystreams' ),
|
||||
'type' => 'Accept',
|
||||
'actor' => \pterotype\actors\get_actor_by_slug( $actor_slug ),
|
||||
'actor' => $actor['id'],
|
||||
'object' => $follow,
|
||||
'to' => $follow['actor'],
|
||||
);
|
||||
|
@ -107,7 +107,7 @@ function make_update( $actor_slug, $object ) {
|
||||
return array(
|
||||
'@context' => array( 'https://www.w3.org/ns/activitystreams' ),
|
||||
'type' => 'Update',
|
||||
'actor' => $actor,
|
||||
'actor' => $actor['id'],
|
||||
'object' => $object
|
||||
);
|
||||
}
|
||||
|
@ -125,7 +125,12 @@ function get_recipient_urls( $object, $depth, $acc ) {
|
||||
}
|
||||
|
||||
function post_activity_to_inboxes( $actor_id, $activity, $recipients, $deliver_locally = true ) {
|
||||
$activity = \pterotype\util\decompact_object( $activity, array( 'actor', 'object' ) );
|
||||
$activity = \pterotype\util\decompact_object( $activity, array( 'object' ) );
|
||||
if ( array_key_exists( 'actor', $activity ) &&
|
||||
is_array( $activity['actor'] ) &&
|
||||
array_key_exists( 'id', $activity['actor'] ) ) {
|
||||
$activity['actor'] = $activity['actor']['id'];
|
||||
}
|
||||
foreach ( $recipients as $inbox ) {
|
||||
if ( $inbox === 'https://www.w3.org/ns/activitystreams#Public' ) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user