From ae81c4f0fa20061def87b3b016b1328c99e21167 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Thu, 30 May 2024 16:15:18 +0000 Subject: [PATCH] Upgrade/Install: Restore Activate button's href native behavior. Restores the Activate button's `href` native behavior by changing the AJAX activation handler introduced in 6.5.0. It restores the pre-6.5 behavior of clicking the "Activate" button, i.e. navigates the user to the button's `href` (i.e. to the `plugins.php` UI). Why? Feedback was given after shipping [57545] in 6.5.0 (but was unknown during the development and testing cycles) revealed significant impacts for plugins who's users valued the onboarding / configuration experiences. 6.5.3's [58081] and [58083] added a new user action / step to the workflow. Though helpful, it did not fully resolve the impacts. For the minor, this commit seeks to restore only the "Activate" button's `href` pre-6.5 native behavior to resolve the regression. The next phase of the Add Plugins workflow can then continue in a major release to gain the benefits of a full major to move it from ideation through the development phases. (See #61040). The questions of redirect, how / should configuration be in the workflow, etc. can best be explored and experimented with in a major. Follow-up to [57545], [58081], [58083]. Reviewed by jorbin. Merges [58250] to the 6.5 branch. Props costdev, jorbin, hellofromTonya, afragen, kevinwhoffman, azaozz, adrianduffell, beaulebens, hmbashar, illuminea, ironprogrammer, jjj, lopo, louiswol94, mikachan, nerrad, mukesh27, peterwilsoncc, pooja1210, smub, swissspidy. Fixes #61319. See #22316, #60992. git-svn-id: https://develop.svn.wordpress.org/branches/6.5@58254 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/wp/updates.js | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index 11f367b934..f3cea6dd85 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -2664,41 +2664,16 @@ } ); /** - * Click handler for plugin activations in plugin activation view. + * Click handler for plugin activations in plugin activation modal view. * * @since 6.5.0 + * @since 6.5.4 Redirect the parent window to the activation URL. * * @param {Event} event Event interface. */ - $pluginFilter.on( 'click', '.activate-now', function( event ) { - var $activateButton = $( event.target ); - + $document.on( 'click', '#plugin-information-footer .activate-now', function( event ) { event.preventDefault(); - - if ( $activateButton.hasClass( 'activating-message' ) || $activateButton.hasClass( 'button-disabled' ) ) { - return; - } - - $activateButton - .removeClass( 'activate-now button-primary' ) - .addClass( 'activating-message' ) - .attr( - 'aria-label', - sprintf( - /* translators: %s: Plugin name. */ - _x( 'Activating %s', 'plugin' ), - $activateButton.data( 'name' ) - ) - ) - .text( __( 'Activating...' ) ); - - wp.updates.activatePlugin( - { - name: $activateButton.data( 'name' ), - slug: $activateButton.data( 'slug' ), - plugin: $activateButton.data( 'plugin' ) - } - ); + window.parent.location.href = $( event.target ).attr( 'href' ); }); /**