updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -7,8 +7,8 @@
|
||||
|
||||
namespace Activitypub\Handler;
|
||||
|
||||
use Activitypub\Comment;
|
||||
use Activitypub\Collection\Interactions;
|
||||
use Activitypub\Comment;
|
||||
|
||||
use function Activitypub\object_to_uri;
|
||||
|
||||
@ -27,10 +27,10 @@ class Like {
|
||||
/**
|
||||
* Handles "Like" requests.
|
||||
*
|
||||
* @param array $like The Activity array.
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
* @param array $like The Activity array.
|
||||
* @param int|int[] $user_ids The user ID(s).
|
||||
*/
|
||||
public static function handle_like( $like, $user_id ) {
|
||||
public static function handle_like( $like, $user_ids ) {
|
||||
if ( ! Comment::is_comment_type_enabled( 'like' ) ) {
|
||||
return;
|
||||
}
|
||||
@ -46,22 +46,23 @@ class Like {
|
||||
return;
|
||||
}
|
||||
|
||||
$state = Interactions::add_reaction( $like );
|
||||
$reaction = null;
|
||||
$success = false;
|
||||
$result = Interactions::add_reaction( $like );
|
||||
|
||||
if ( $state && ! is_wp_error( $state ) ) {
|
||||
$reaction = get_comment( $state );
|
||||
if ( $result && ! is_wp_error( $result ) ) {
|
||||
$success = true;
|
||||
$result = get_comment( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after a Like has been handled.
|
||||
* Fires after an ActivityPub Like activity has been handled.
|
||||
*
|
||||
* @param array $like The Activity array.
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
* @param mixed $state The state of the reaction.
|
||||
* @param mixed $reaction The reaction object.
|
||||
* @param array $like The ActivityPub activity data.
|
||||
* @param int[] $user_ids The local user IDs.
|
||||
* @param bool $success True on success, false otherwise.
|
||||
* @param array|false|int|string|\WP_Comment|\WP_Error $result The WP_Comment object of the created like comment, or null if creation failed.
|
||||
*/
|
||||
do_action( 'activitypub_handled_like', $like, $user_id, $state, $reaction );
|
||||
\do_action( 'activitypub_handled_like', $like, (array) $user_ids, $success, $result );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user