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
This commit is contained in:
Matt Sherman 2020-06-10 10:16:56 -04:00 committed by GitHub
parent 9fed1c307b
commit 369072b7df
3 changed files with 12 additions and 1 deletions

View File

@ -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'" );
}

View File

@ -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',
),
);
/**

View File

@ -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;
}