PluginProbe
ActivityPub / 2.6.0
ActivityPub v2.6.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/handler/class-update.php +15 -9 1.3.02.6.0 View file →
@@ -13,9 +13,12 @@
13 13 /**
14 14 * Initialize the class, registering WordPress hooks
15 15 */
16 16 public static function init() {
17 - \add_action( 'activitypub_inbox_update', array( self::class, 'handle_update' ), 10, 2 );
17 + \add_action(
18 + 'activitypub_inbox_update',
19 + array( self::class, 'handle_update' )
20 + );
18 21 }
19 22
20 23 /**
21 24 * Handle "Update" requests
@@ -22,9 +25,9 @@
22 25 *
23 26 * @param array $array The activity-object
24 27 * @param int $user_id The id of the local blog-user
25 28 */
26 - public static function handle_update( $array, $user_id ) {
29 + public static function handle_update( $array ) {
27 30 $object_type = isset( $array['object']['type'] ) ? $array['object']['type'] : '';
28 31
29 32 switch ( $object_type ) {
30 33 // Actor Types
@@ -44,9 +47,9 @@
44 47 case 'Audio':
45 48 case 'Video':
46 49 case 'Event':
47 50 case 'Document':
48 - self::update_interaction( $array, $user_id );
51 + self::update_interaction( $array );
49 52 break;
50 53 // Minimal Activity
51 54 // @see https://www.w3.org/TR/activitystreams-core/#example-1
52 55 default:
@@ -61,17 +64,20 @@
61 64 * @param int $user_id The id of the local blog-user
62 65 *
63 66 * @return void
64 67 */
65 - public static function update_interaction( $activity, $user_id ) {
66 - $state = Interactions::update_comment( $activity );
67 - $reaction = null;
68 + public static function update_interaction( $activity ) {
69 + $commentdata = Interactions::update_comment( $activity );
70 + $reaction = null;
68 71
69 - if ( $state && ! \is_wp_error( $reaction ) ) {
70 - $reaction = \get_comment( $state );
72 + if ( ! empty( $commentdata['comment_ID'] ) ) {
73 + $state = 1;
74 + $reaction = \get_comment( $commentdata['comment_ID'] );
75 + } else {
76 + $state = $commentdata;
71 77 }
72 78
73 - \do_action( 'activitypub_handled_update', $activity, $user_id, $state, $reaction );
79 + \do_action( 'activitypub_handled_update', $activity, null, $state, $reaction );
74 80 }
75 81
76 82 /**
77 83 * Update an Actor