Make WordPress Core

Ticket #50346: 50346.diff

File 50346.diff, 2.1 KB (added by samful, 5 years ago)

adds classes "has-plugin-data" and "no-plugin-data" that allow the JS to display a different un-install message

  • src/js/_enqueues/wp/updates.js

    diff --git src/js/_enqueues/wp/updates.js src/js/_enqueues/wp/updates.js
    index ff8cb07..9605d7b 100644
     
    21372137                 * @param {Event} event Event interface.
    21382138                 */
    21392139                $bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) {
    2140                         var $pluginRow = $( event.target ).parents( 'tr' ),
    2141                                 confirmMessage = sprintf(
     2140                        var $pluginRow = $( event.target ).parents( 'tr' );
     2141
     2142                        if($(event.target).hasClass('no-plugin-data')){
     2143                                var confirmMessage = sprintf(
     2144                                        /* translators: %s: Plugin name. */
     2145                                        __( 'Are you sure you want to delete %s?' ),
     2146                                        $pluginRow.find( '.plugin-title strong' ).text()
     2147                                );
     2148                        } else {
     2149                                var confirmMessage = sprintf(
    21422150                                        /* translators: %s: Plugin name. */
    21432151                                        __( 'Are you sure you want to delete %s and its data?' ),
    21442152                                        $pluginRow.find( '.plugin-title strong' ).text()
    21452153                                );
     2154                        }
    21462155
    21472156                        event.preventDefault();
    21482157
  • src/wp-admin/includes/class-wp-plugins-list-table.php

    diff --git src/wp-admin/includes/class-wp-plugins-list-table.php src/wp-admin/includes/class-wp-plugins-list-table.php
    index d3233b4..fb41301 100644
    class WP_Plugins_List_Table extends WP_List_Table { 
    757757                                        }
    758758
    759759                                        if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
     760
     761                                                $has_plugin_data = is_uninstallable_plugin($plugin_file) ? "has-plugin-data" : "no-plugin-data";
     762
    760763                                                $actions['delete'] = sprintf(
    761                                                         '<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
     764                                                        '<a href="%s" id="delete-%s" class="delete%s" aria-label="%s">%s</a>',
    762765                                                        wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
    763766                                                        esc_attr( $plugin_slug ),
     767                                                        " $has_plugin_data",
    764768                                                        /* translators: %s: Plugin name. */
    765769                                                        esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
    766770                                                        __( 'Delete' )