From 369072b7dfa1a734ff10ea88f45c338f5aec675e Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Wed, 10 Jun 2020 10:16:56 -0400 Subject: [PATCH] Inbox: Remove (duplicate) dismiss button on tracking opt-in note (https://github.com/woocommerce/woocommerce-admin/pull/4500) * Do not add Dismiss button to tracking opt-in note * Remove `tracking-dismiss` action from DB on upgrade --- .../includes/wc-admin-update-functions.php | 9 +++++++++ plugins/woocommerce-admin/src/Install.php | 3 +++ .../src/Notes/WC_Admin_Notes_Tracking_Opt_In.php | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/includes/wc-admin-update-functions.php b/plugins/woocommerce-admin/includes/wc-admin-update-functions.php index 72250e7d7b7..fb411d45ad4 100644 --- a/plugins/woocommerce-admin/includes/wc-admin-update-functions.php +++ b/plugins/woocommerce-admin/includes/wc-admin-update-functions.php @@ -91,3 +91,12 @@ function wc_admin_update_110_remove_facebook_note() { function wc_admin_update_110_db_version() { Installer::update_db_version( '1.1.0' ); } + +/** + * Remove Dismiss action from tracking opt-in admin note. + */ +function wc_admin_update_130_remove_dismiss_action_from_tracking_opt_in_note() { + global $wpdb; + + $wpdb->query( "DELETE actions FROM {$wpdb->prefix}wc_admin_note_actions actions INNER JOIN {$wpdb->prefix}wc_admin_notes notes USING (note_id) WHERE actions.name = 'tracking-dismiss' AND notes.name = 'wc-admin-usage-tracking-opt-in'" ); +} diff --git a/plugins/woocommerce-admin/src/Install.php b/plugins/woocommerce-admin/src/Install.php index 466c1df1e02..c3be71c9afa 100644 --- a/plugins/woocommerce-admin/src/Install.php +++ b/plugins/woocommerce-admin/src/Install.php @@ -44,6 +44,9 @@ class Install { 'wc_admin_update_110_remove_facebook_note', 'wc_admin_update_110_db_version', ), + '1.3.0' => array( + 'wc_admin_update_130_remove_dismiss_action_from_tracking_opt_in_note', + ), ); /** diff --git a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Tracking_Opt_In.php b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Tracking_Opt_In.php index 3f251e3e548..fe34772ce2e 100644 --- a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Tracking_Opt_In.php +++ b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Tracking_Opt_In.php @@ -66,7 +66,6 @@ class WC_Admin_Notes_Tracking_Opt_In { $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_name( self::NOTE_NAME ); $note->set_source( 'woocommerce-admin' ); - $note->add_action( 'tracking-dismiss', __( 'Dismiss', 'woocommerce-admin' ), false, WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, false ); $note->add_action( 'tracking-opt-in', __( 'Activate usage tracking', 'woocommerce-admin' ), false, WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, true ); return $note; }