From 9709cc4f06a52beb79b71d1343ae47e28cf01741 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Tue, 27 Mar 2018 10:27:56 -0400 Subject: [PATCH] Revert "Add/user tracking option api (#9003)" This reverts commit c9b754c350a6e56e83bf69a542ef32e29f2f20b1. --- .../lib/class.jetpack-user-event-tracking.php | 50 ------------------- phpunit.xml.dist | 1 - sync/class.jetpack-sync-defaults.php | 3 +- sync/class.jetpack-sync-functions.php | 5 -- sync/class.jetpack-sync-module-users.php | 10 +--- tests/php.multisite.xml | 15 +++--- .../test_class.jetpack-sync-callables.php | 1 - ...test_class.jetpack-user-event-tracking.php | 36 ------------- 8 files changed, 9 insertions(+), 112 deletions(-) delete mode 100644 _inc/lib/class.jetpack-user-event-tracking.php delete mode 100644 tests/php/test_class.jetpack-user-event-tracking.php diff --git a/_inc/lib/class.jetpack-user-event-tracking.php b/_inc/lib/class.jetpack-user-event-tracking.php deleted file mode 100644 index 227c04e7b4887..0000000000000 --- a/_inc/lib/class.jetpack-user-event-tracking.php +++ /dev/null @@ -1,50 +0,0 @@ -tests/php/test_class.jetpack-constants.php tests/php/test_class.jetpack-connection-banner.php tests/php/test_class.jetpack-options.php - tests/php/test_class.jetpack-user-event-tracking.php tests/php/test_php-lint.php diff --git a/sync/class.jetpack-sync-defaults.php b/sync/class.jetpack-sync-defaults.php index a46f64bd83ba1..8e24178a95ecc 100644 --- a/sync/class.jetpack-sync-defaults.php +++ b/sync/class.jetpack-sync-defaults.php @@ -192,8 +192,7 @@ public static function get_constants_whitelist() { 'hosting_provider' => array( 'Jetpack_Sync_Functions', 'get_hosting_provider' ), 'locale' => 'get_locale', 'site_icon_url' => array( 'Jetpack_Sync_Functions', 'site_icon_url' ), - 'roles' => array( 'Jetpack_Sync_Functions', 'roles' ), - 'default_user_event_tracking' => array( 'Jetpack_Sync_functions', 'get_default_user_tracking_value' ) + 'roles' => array( 'Jetpack_Sync_Functions', 'roles' ), ); diff --git a/sync/class.jetpack-sync-functions.php b/sync/class.jetpack-sync-functions.php index 34e8ceb6c1ec4..8fbe3dc9da750 100644 --- a/sync/class.jetpack-sync-functions.php +++ b/sync/class.jetpack-sync-functions.php @@ -33,11 +33,6 @@ public static function get_shortcodes() { return array_keys( $shortcode_tags ); } - public static function get_default_user_tracking_value() { - jetpack_require_lib( 'class.jetpack-user-event-tracking' ); - return Jetpack_User_Event_Tracking::default_value(); - } - /** * Removes any callback data since we will not be able to process it on our side anyways. */ diff --git a/sync/class.jetpack-sync-module-users.php b/sync/class.jetpack-sync-module-users.php index 6310932646954..005a9fd4273d9 100644 --- a/sync/class.jetpack-sync-module-users.php +++ b/sync/class.jetpack-sync-module-users.php @@ -112,10 +112,7 @@ public function expand_user( $user ) { $user->locale = get_user_locale( $user->ID ); } } - jetpack_require_lib( 'class.jetpack-user-event-tracking' ); - if ( Jetpack_User_Event_Tracking::has_value( $user->ID ) ) { - $user->jetpack_tracking_enabled = Jetpack_User_Event_Tracking::is_enabled( $user->ID ); - } + return $user; } @@ -289,11 +286,6 @@ function maybe_save_user_meta( $meta_id, $user_id, $meta_key, $value ) { $this->add_flags( $user_id, array( 'locale_changed' => true ) ); } - jetpack_require_lib( 'class.jetpack-user-event-tracking' ); - if ( $meta_key === Jetpack_User_Event_Tracking::$KEY ) { - $this->add_flags( $user_id, array( 'tracking_opt_out_changed' => true ) ); - } - $user = get_user_by( 'id', $user_id ); if ( $meta_key === $user->cap_key ) { $this->add_flags( $user_id, array( 'capabilities_changed' => true ) ); diff --git a/tests/php.multisite.xml b/tests/php.multisite.xml index e8398c03b1f81..f49fa3ed60b7a 100644 --- a/tests/php.multisite.xml +++ b/tests/php.multisite.xml @@ -8,14 +8,13 @@ - php/test_class.jetpack.php - php/test_class.functions.compat.php - php/test_class.jetpack-network.php - php/test_class.jetpack-client-server.php - php/test_class.jetpack-xmlrpc-server.php - php/test_class.jetpack-heartbeat.php - php/test_class.jetpack-user-event-tracking.php - + php/test_class.jetpack.php + php/test_class.functions.compat.php + php/test_class.jetpack-network.php + php/test_class.jetpack-client-server.php + php/test_class.jetpack-xmlrpc-server.php + php/test_class.jetpack-heartbeat.php + tests/php/core-api diff --git a/tests/php/sync/test_class.jetpack-sync-callables.php b/tests/php/sync/test_class.jetpack-sync-callables.php index 613c62983b02f..65e901eb37484 100644 --- a/tests/php/sync/test_class.jetpack-sync-callables.php +++ b/tests/php/sync/test_class.jetpack-sync-callables.php @@ -83,7 +83,6 @@ public function test_sync_callable_whitelist() { 'site_icon_url' => Jetpack_Sync_Functions::site_icon_url(), 'shortcodes' => Jetpack_Sync_Functions::get_shortcodes(), 'roles' => Jetpack_Sync_Functions::roles(), - 'default_user_event_tracking' => Jetpack_Sync_Functions::get_default_user_tracking_value() ); if ( function_exists( 'wp_cache_is_enabled' ) ) { diff --git a/tests/php/test_class.jetpack-user-event-tracking.php b/tests/php/test_class.jetpack-user-event-tracking.php deleted file mode 100644 index c638109fcb7c2..0000000000000 --- a/tests/php/test_class.jetpack-user-event-tracking.php +++ /dev/null @@ -1,36 +0,0 @@ -user_id = $this->factory->user->create(); - } - - public function test_default_value_is_disabled() { - $this->assertFalse( Jetpack_User_Event_Tracking::is_disabled( $this->user_id ) ); - $this->assertTrue( Jetpack_User_Event_Tracking::is_enabled( $this->user_id ) ); - } - - public function test_enabeling_tracking() { - Jetpack_User_Event_Tracking::enable( $this->user_id ); - $this->assertTrue( Jetpack_User_Event_Tracking::is_enabled( $this->user_id ) ); - } - - public function test_disabeling_tracking() { - Jetpack_User_Event_Tracking::disable( $this->user_id ); - $this->assertFalse( Jetpack_User_Event_Tracking::is_enabled( $this->user_id ) ); - } - - public function test_filter_works_as_expected() { - // by default opt out every user - add_filter( 'jetpack_user_event_tracking', '__return_false' ); - $user_id = $this->factory->user->create(); - $this->assertFalse( Jetpack_User_Event_Tracking::is_enabled( $user_id ) ); - } -}