From 5ab3541791575a0352824c28e28cbe5d4f1dd54d Mon Sep 17 00:00:00 2001 From: Vrishabhsk Date: Fri, 30 May 2025 13:53:15 +0400 Subject: [PATCH 1/2] Revert the "Deleting..." to "Delete" on failed user permission --- src/js/_enqueues/wp/updates.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index aca73fdd4f748..453ff5f68ab59 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -1488,19 +1488,27 @@ * @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' ) ); } if ( ! wp.updates.isValidResponse( response, 'delete' ) ) { From 2c93bb12592063faa7da463e47113752eb68ae5e Mon Sep 17 00:00:00 2001 From: Vrishabhsk Date: Tue, 3 Jun 2025 14:59:34 +0400 Subject: [PATCH 2/2] Revert all delete button texts to their original text as fallback --- src/js/_enqueues/wp/updates.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index 453ff5f68ab59..d3abf1e91949a 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -1509,6 +1509,13 @@ 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' ) ) {