Skip to content

Commit a6251ee

Browse files
committed
Jetpack: Support comment management in Calypso
1 parent 56308cd commit a6251ee

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Added a filter to make custom comment types manageable in WP.com Calypso
1213
* `@mentions` in the JSON representation of the reply
1314

1415
### Improved

integration/class-jetpack.php

+16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class Jetpack {
1717
*/
1818
public static function init() {
1919
\add_filter( 'jetpack_sync_post_meta_whitelist', array( self::class, 'add_sync_meta' ) );
20+
\add_filter( 'jetpack_json_api_comment_types', array( self::class, 'add_comment_types' ) );
21+
\add_filter( 'jetpack_api_include_comment_types_count', array( self::class, 'add_comment_types' ) );
2022
}
2123

2224
/**
@@ -37,4 +39,18 @@ public static function add_sync_meta( $allow_list ) {
3739
);
3840
return \array_merge( $allow_list, $activitypub_meta_keys );
3941
}
42+
43+
/**
44+
* Add custom comment types to the list of comment types.
45+
*
46+
* @param array $comment_types Default comment types.
47+
* @return array
48+
*/
49+
public static function add_comment_types( $comment_types ) {
50+
if ( \method_exists( 'Activitypub\Comment', 'get_comment_type_slugs' ) ) {
51+
$comment_types = \array_merge( $comment_types, \Activitypub\Comment::get_comment_type_slugs() );
52+
}
53+
54+
return array_unique( $comment_types );
55+
}
4056
}

readme.txt

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ For reasons of data protection, it is not possible to see the followers of other
134134

135135
= Unreleased =
136136

137+
* Added: A filter to make custom comment types manageable in WP.com Calypso
137138
* Improved: HTML to e-mail text conversion
138139

139140
= 4.5.1 =

0 commit comments

Comments
 (0)