PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.2
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/rest/class-replies-controller.php +5 -18 8.2.07.8.2 View file →
@@ -11,9 +11,8 @@
11 11 use Activitypub\Collection\Interactions;
12 12 use Activitypub\Collection\Replies;
13 13
14 14 use function Activitypub\get_rest_url_by_path;
15 -use function Activitypub\is_post_publicly_queryable;
16 15
17 16 /**
18 17 * ActivityPub Replies_Controller class.
19 18 */
@@ -30,9 +29,9 @@
30 29 * The base of this controller's route.
31 30 *
32 31 * @var string
33 32 */
34 - protected $rest_base = '(?P<object_type>[\w\-\.]+)s/(?P<id>[\d]+)/(?P<type>[\w\-\.]+)';
33 + protected $rest_base = '(?P<object_type>[\w\-\.]+)s/(?P<id>[\w\-\.]+)/(?P<type>[\w\-\.]+)';
35 34
36 35 /**
37 36 * Register routes.
38 37 */
@@ -49,10 +48,9 @@
49 48 'required' => true,
50 49 ),
51 50 'id' => array(
52 51 'description' => 'The ID of the object.',
53 - 'type' => 'integer',
54 - 'minimum' => 1,
52 + 'type' => 'string',
55 53 'required' => true,
56 54 ),
57 55 'type' => array(
58 56 'description' => 'The type of collection to query.',
@@ -91,24 +89,13 @@
91 89 $id = (int) $request->get_param( 'id' );
92 90
93 91 if ( 'comment' === $object_type ) {
94 92 $wp_object = \get_comment( $id );
95 -
96 - /*
97 - * A comment inherits the visibility of its parent post. Reject
98 - * collections for comments whose parent post is not currently
99 - * publicly queryable, so we don't leak metadata for private,
100 - * draft, password-protected, or local-only posts — including
101 - * posts that were once federated and have since been made
102 - * non-public.
103 - */
104 - $publicly_queryable = $wp_object && is_post_publicly_queryable( $wp_object->comment_post_ID );
105 93 } else {
106 - $wp_object = \get_post( $id );
107 - $publicly_queryable = $wp_object && is_post_publicly_queryable( $wp_object );
94 + $wp_object = \get_post( $id );
108 95 }
109 96
110 - if ( ! $publicly_queryable ) {
97 + if ( ! isset( $wp_object ) || \is_wp_error( $wp_object ) ) {
111 98 return new \WP_Error(
112 99 'activitypub_replies_collection_does_not_exist',
113 100 \sprintf(
114 101 // translators: %s: The type (post, comment, etc.) for which no replies collection exists.
@@ -196,9 +183,9 @@
196 183 * @return array Response collection of shares.
197 184 */
198 185 public function get_shares( $request, $wp_object ) {
199 186 if ( $wp_object instanceof \WP_Post ) {
200 - $shares = Interactions::count_by_type( $wp_object->ID, 'repost' ) + Interactions::count_by_type( $wp_object->ID, 'quote' );
187 + $shares = Interactions::count_by_type( $wp_object->ID, 'repost' );
201 188 } else {
202 189 $shares = 0;
203 190 }
204 191