updated plugin ActivityPub
version 0.17.0
This commit is contained in:
@ -45,20 +45,28 @@ class Activity {
|
||||
}
|
||||
}
|
||||
|
||||
public function from_post( $object ) {
|
||||
$this->object = $object;
|
||||
public function from_post( Post $post ) {
|
||||
$this->object = $post->to_array();
|
||||
|
||||
if ( isset( $object['published'] ) ) {
|
||||
$this->published = $object['published'];
|
||||
}
|
||||
$this->cc = array( \get_rest_url( null, '/activitypub/1.0/users/' . intval( $post->get_post_author() ) . '/followers' ) );
|
||||
|
||||
if ( isset( $object['attributedTo'] ) ) {
|
||||
$this->actor = $object['attributedTo'];
|
||||
if ( isset( $this->object['attributedTo'] ) ) {
|
||||
$this->actor = $this->object['attributedTo'];
|
||||
}
|
||||
|
||||
foreach ( $post->get_tags() as $tag ) {
|
||||
if ( 'Mention' === $tag['type'] ) {
|
||||
$this->cc[] = $tag['href'];
|
||||
}
|
||||
}
|
||||
|
||||
$type = \strtolower( $this->type );
|
||||
|
||||
if ( isset( $object['id'] ) ) {
|
||||
$this->id = add_query_arg( 'activity', $type, $object['id'] );
|
||||
if ( isset( $this->object['id'] ) ) {
|
||||
$this->id = add_query_arg( 'activity', $type, $this->object['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user