updated plugin ActivityPub
version 5.8.0
This commit is contained in:
@ -20,12 +20,8 @@ class Like {
|
||||
* Initialize the class, registering WordPress hooks.
|
||||
*/
|
||||
public static function init() {
|
||||
\add_action(
|
||||
'activitypub_inbox_like',
|
||||
array( self::class, 'handle_like' ),
|
||||
10,
|
||||
3
|
||||
);
|
||||
\add_action( 'activitypub_inbox_like', array( self::class, 'handle_like' ), 10, 2 );
|
||||
\add_filter( 'activitypub_get_outbox_activity', array( self::class, 'outbox_activity' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,7 +31,7 @@ class Like {
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
*/
|
||||
public static function handle_like( $like, $user_id ) {
|
||||
if ( ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) {
|
||||
if ( ! Comment::is_comment_type_enabled( 'like' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -67,4 +63,18 @@ class Like {
|
||||
*/
|
||||
do_action( 'activitypub_handled_like', $like, $user_id, $state, $reaction );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object to the object ID.
|
||||
*
|
||||
* @param \Activitypub\Activity\Activity $activity The Activity object.
|
||||
* @return \Activitypub\Activity\Activity The filtered Activity object.
|
||||
*/
|
||||
public static function outbox_activity( $activity ) {
|
||||
if ( 'Like' === $activity->get_type() ) {
|
||||
$activity->set_object( object_to_uri( $activity->get_object() ) );
|
||||
}
|
||||
|
||||
return $activity;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user