diff --git a/projects/packages/podcast/changelog/add-podcast-show-launched-activity-log b/projects/packages/podcast/changelog/add-podcast-show-launched-activity-log new file mode 100644 index 000000000000..925787d9fc24 --- /dev/null +++ b/projects/packages/podcast/changelog/add-podcast-show-launched-activity-log @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Podcast: Whitelist `podcast_show_launched_tracked` for Jetpack Sync so its `added_option` event reaches WPcom, where a downstream listener surfaces the launch in the customer's Activity Log UI. diff --git a/projects/packages/podcast/src/class-tracks.php b/projects/packages/podcast/src/class-tracks.php index a19dbdb571da..7079673bc645 100644 --- a/projects/packages/podcast/src/class-tracks.php +++ b/projects/packages/podcast/src/class-tracks.php @@ -43,6 +43,21 @@ public static function init(): void { add_action( 'update_option_podcasting_show_urls', array( __CLASS__, 'record_show_url_updated' ), 10, 3 ); add_filter( 'rest_request_after_callbacks', array( __CLASS__, 'record_settings_saved' ), 10, 3 ); + + add_filter( 'jetpack_sync_options_whitelist', array( __CLASS__, 'allow_show_launched_option_sync' ) ); + } + + /** + * Whitelist `podcast_show_launched_tracked` for Jetpack Sync so its + * `added_option` event reaches WPcom, where a listener surfaces the + * launch in the customer's Activity Log UI. + * + * @param array $options Whitelisted option names. + * @return array + */ + public static function allow_show_launched_option_sync( $options ): array { + $options[] = 'podcast_show_launched_tracked'; + return $options; } /** diff --git a/projects/packages/podcast/tests/php/Tracks_Test.php b/projects/packages/podcast/tests/php/Tracks_Test.php index aee2ca19387f..fae6647e2b1c 100644 --- a/projects/packages/podcast/tests/php/Tracks_Test.php +++ b/projects/packages/podcast/tests/php/Tracks_Test.php @@ -333,4 +333,20 @@ public function test_settings_saved_suppressed_when_response_is_an_error() { $this->assertEmpty( $this->events_named( 'wpcom_podcasting_settings_saved' ) ); } + + public function test_allow_show_launched_option_sync_appends_option() { + $this->assertContains( + 'podcast_show_launched_tracked', + Tracks::allow_show_launched_option_sync( array( 'blogname' ) ) + ); + } + + public function test_init_registers_sync_whitelist_filter() { + Tracks::init(); + + $this->assertContains( + 'podcast_show_launched_tracked', + apply_filters( 'jetpack_sync_options_whitelist', array() ) + ); + } }