diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index aca73fdd4f748..d3abf1e91949a 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -1488,19 +1488,34 @@ * @param {string} response.errorMessage The error that occurred. */ wp.updates.deletePluginError = function( response ) { - var $plugin, $pluginUpdateRow, + var $plugin, $pluginUpdateRow, $pluginDataSlug, pluginUpdateRow = wp.template( 'item-update-row' ), noticeContent = wp.updates.adminNotice( { className: 'update-message notice-error notice-alt', message: response.errorMessage } ); - + if ( response.plugin ) { $plugin = $( 'tr.inactive[data-plugin="' + response.plugin + '"]' ); - $pluginUpdateRow = $plugin.siblings( '[data-plugin="' + response.plugin + '"]' ); + $pluginUpdateRow = $plugin.siblings('[data-plugin="' + response.plugin + '"]'); + $pluginDataSlug = response.plugin; + } else { $plugin = $( 'tr.inactive[data-slug="' + response.slug + '"]' ); $pluginUpdateRow = $plugin.siblings( '[data-slug="' + response.slug + '"]' ); + $pluginDataSlug = response.slug; + } + + if ( $pluginDataSlug ) { + $link = $('[data-slug="' + $pluginDataSlug + '"]').find('.row-actions a.delete'); + $link.text( $link.data( 'originaltext' ) ); + } else { + // As a fallback, find the elements with text as "deleting..." and reset it to the original text + $('[data-slug]').find('.row-actions a.delete').each(function() { + if ( $(this).text() === __( 'Deleting...' ) ) { + $(this).text( $(this).data( 'originaltext' ) ); + } + }); } if ( ! wp.updates.isValidResponse( response, 'delete' ) ) {