PluginProbe
ActivityPub / 8.0.2
ActivityPub v8.0.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/class-comment.php +10 -25 9.0.28.0.2 View file →
@@ -7,9 +7,9 @@
7 7
8 8 namespace Activitypub;
9 9
10 10 use Activitypub\Collection\Actors;
11 -use Activitypub\Collection\Remote_Posts;
11 +use Activitypub\Collection\Posts;
12 12
13 13 /**
14 14 * ActivityPub Comment Class.
15 15 *
@@ -298,19 +298,8 @@
298 298 if ( ! user_can_activitypub( $user_id ) ) {
299 299 return false;
300 300 }
301 301
302 - /*
303 - * Do not federate brand-new comments on a post that is not federated itself
304 - * (e.g. a private post, a post switched to local visibility, or a non-ActivityPub
305 - * post type). This prevents leaking replies on content the post type's read rules
306 - * would otherwise protect. Comments that were already sent are allowed through so
307 - * their Update and Delete activities can still federate (and tear down remote copies).
308 - */
309 - if ( ! self::was_sent( $comment ) && ! is_post_federated( $comment->comment_post_ID ) ) {
310 - return false;
311 - }
312 -
313 302 // It is a comment to the post and can be federated.
314 303 if ( empty( $comment->comment_parent ) ) {
315 304 return true;
316 305 }
@@ -591,9 +580,9 @@
591 580 */
592 581 public static function get_comment_types() {
593 582 global $activitypub_comment_types;
594 583
595 - return (array) $activitypub_comment_types;
584 + return $activitypub_comment_types;
596 585 }
597 586
598 587 /**
599 588 * Is this a registered comment type.
@@ -871,19 +860,8 @@
871 860 ) {
872 861 return 1;
873 862 }
874 863
875 - /*
876 - * Always auto-approve comments on remote posts (ap_post) since
877 - * they are not visible in the WP admin comment moderation screen.
878 - */
879 - $post_id = $comment_data['comment_post_ID'];
880 - $post = \get_post( $post_id );
881 -
882 - if ( $post && \in_array( $post->post_type, self::hide_for(), true ) ) {
883 - return 1;
884 - }
885 -
886 864 if ( '1' !== \get_option( 'comment_previously_approved' ) ) {
887 865 return $approved;
888 866 }
889 867
@@ -904,8 +882,15 @@
904 882 if ( 1 === (int) $ok_to_comment ) {
905 883 return 1;
906 884 }
907 885
886 + $post_id = $comment_data['comment_post_ID'];
887 + $post = \get_post( $post_id );
888 +
889 + if ( $post && in_array( $post->post_type, self::hide_for(), true ) ) {
890 + return 1;
891 + }
892 +
908 893 return $approved;
909 894 }
910 895
911 896 /**
@@ -987,9 +972,9 @@
987 972 *
988 973 * @return string[] Array of post type names to hide comments for.
989 974 */
990 975 public static function hide_for() {
991 - $post_types = array( Remote_Posts::POST_TYPE );
976 + $post_types = array( Posts::POST_TYPE );
992 977
993 978 /**
994 979 * Filters the list of post types to hide comments for.
995 980 *