mirror of
https://github.com/Automattic/wordpress-activitypub
synced 2024-10-18 20:23:31 +00:00
89a57302c6
* Notifications: introduce general class and use it for new follows Also send stuff via Jetpack --------- Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
24 lines
591 B
PHP
24 lines
591 B
PHP
<?php
|
|
namespace Activitypub\Integration;
|
|
|
|
class Jetpack {
|
|
|
|
public static function init() {
|
|
\add_action( 'activitypub_notification', [ self::class, 'send' ] );
|
|
}
|
|
|
|
public static function send( $notification ) {
|
|
\Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_user(
|
|
sprintf( '/sites/%d/activitypub/notify', \Jetpack_Options::get_option( 'id' ) ),
|
|
'2',
|
|
[ 'method' => 'POST' ],
|
|
[
|
|
'actor' => $notification->actor,
|
|
'object' => $notification->object,
|
|
'target' => $notification->target,
|
|
'type' => $notification->type,
|
|
],
|
|
'wpcom'
|
|
);
|
|
}
|
|
}
|