| @@ -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 | * |
| @@ -580,9 +580,9 @@ | ||
| 580 | 580 | */ |
| 581 | 581 | public static function get_comment_types() { |
| 582 | 582 | global $activitypub_comment_types; |
| 583 | 583 | |
| 584 | - return (array) $activitypub_comment_types; | |
| 584 | + return $activitypub_comment_types; | |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
| 588 | 588 | * Is this a registered comment type. |
| @@ -860,19 +860,8 @@ | ||
| 860 | 860 | ) { |
| 861 | 861 | return 1; |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - /* | |
| 865 | - * Always auto-approve comments on remote posts (ap_post) since | |
| 866 | - * they are not visible in the WP admin comment moderation screen. | |
| 867 | - */ | |
| 868 | - $post_id = $comment_data['comment_post_ID']; | |
| 869 | - $post = \get_post( $post_id ); | |
| 870 | - | |
| 871 | - if ( $post && \in_array( $post->post_type, self::hide_for(), true ) ) { | |
| 872 | - return 1; | |
| 873 | - } | |
| 874 | - | |
| 875 | 864 | if ( '1' !== \get_option( 'comment_previously_approved' ) ) { |
| 876 | 865 | return $approved; |
| 877 | 866 | } |
| 878 | 867 | |
| @@ -893,8 +882,15 @@ | ||
| 893 | 882 | if ( 1 === (int) $ok_to_comment ) { |
| 894 | 883 | return 1; |
| 895 | 884 | } |
| 896 | 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 | + | |
| 897 | 893 | return $approved; |
| 898 | 894 | } |
| 899 | 895 | |
| 900 | 896 | /** |
| @@ -976,9 +972,9 @@ | ||
| 976 | 972 | * |
| 977 | 973 | * @return string[] Array of post type names to hide comments for. |
| 978 | 974 | */ |
| 979 | 975 | public static function hide_for() { |
| 980 | - $post_types = array( Remote_Posts::POST_TYPE ); | |
| 976 | + $post_types = array( Posts::POST_TYPE ); | |
| 981 | 977 | |
| 982 | 978 | /** |
| 983 | 979 | * Filters the list of post types to hide comments for. |
| 984 | 980 | * |