Skip to content

Commit 3bd67d7

Browse files
obenlandpfefferle
andauthored
Jetpack: Support comment management in Calypso (#1104)
* Jetpack: Support comment management in Calypso * No need to check whether the method exists. --------- Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent 3dac6c1 commit 3bd67d7

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
* Added a filter to make custom comment types manageable in WP.com Calypso
13+
1014
### Fixed
1115

1216
* Undefined array key warnings in various places

integration/class-jetpack.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace Activitypub\Integration;
99

10+
use Activitypub\Comment;
11+
1012
/**
1113
* Jetpack integration class.
1214
*/
@@ -17,6 +19,8 @@ class Jetpack {
1719
*/
1820
public static function init() {
1921
\add_filter( 'jetpack_sync_post_meta_whitelist', array( self::class, 'add_sync_meta' ) );
22+
\add_filter( 'jetpack_json_api_comment_types', array( self::class, 'add_comment_types' ) );
23+
\add_filter( 'jetpack_api_include_comment_types_count', array( self::class, 'add_comment_types' ) );
2024
}
2125

2226
/**
@@ -37,4 +41,14 @@ public static function add_sync_meta( $allow_list ) {
3741
);
3842
return \array_merge( $allow_list, $activitypub_meta_keys );
3943
}
44+
45+
/**
46+
* Add custom comment types to the list of comment types.
47+
*
48+
* @param array $comment_types Default comment types.
49+
* @return array
50+
*/
51+
public static function add_comment_types( $comment_types ) {
52+
return array_unique( \array_merge( $comment_types, Comment::get_comment_type_slugs() ) );
53+
}
4054
}

readme.txt

Lines changed: 1 addition & 0 deletions
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
* Fixed: Undefined array key warnings in various places
138139

139140
= 4.6.0 =

0 commit comments

Comments
 (0)