Make WordPress Core

Changeset 58258


Ignore:
Timestamp:
05/30/2024 05:24:44 PM (7 weeks ago)
Author:
hellofromTonya
Message:

Plugins: Revert r58083 show an admin notice on successful activation.

With a new direction in the 6.5.4 to restore the Activate button's href (see #61319 / [58250]), the changesets committed for 6.5.3 (see #60992) are now dead code and will not render the admin notice on successful plugin activation.

This commit is a clean revert of r58083.

Follow-up to [58250], [58257].

Reviewed by jorbin.
Reverts [58083] on the 6.5 branch.

Props swissspidy, azaozz, costdev, jorbin, hellofromTonya, afragen.
Fixes #61331.
See #60992.

Location:
branches/6.5
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/6.5

    • Property svn:mergeinfo changed
      /trunkreverse-merged: 58081
  • branches/6.5/src/js/_enqueues/wp/updates.js

    r58254 r58258  
    11061106     * @since 6.5.0
    11071107     *
    1108      * @param {Object} response            Response from the server.
    1109      * @param {string} response.slug       Slug of the activated plugin.
    1110      * @param {string} response.pluginName Name of the activated plugin.
    1111      * @param {string} response.plugin     The plugin file, relative to the plugins directory.
     1108     * @param {Object} response             Response from the server.
     1109     * @param {string} response.slug        Slug of the activated plugin.
     1110     * @param {string} response.pluginName  Name of the activated plugin.
     1111     * @param {string} response.plugin      The plugin file, relative to the plugins directory.
    11121112     */
    11131113    wp.updates.activatePluginSuccess = function( response ) {
    11141114        var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
    1115             isInModal = 'plugin-information-footer' === $message.parent().attr( 'id' ),
    11161115            buttonText = _x( 'Activated!', 'plugin' ),
    11171116            ariaLabel = sprintf(
     
    11191118                '%s activated successfully.',
    11201119                response.pluginName
    1121             ),
    1122             noticeData = {
    1123                 id: 'plugin-activated-successfully',
    1124                 className: 'notice-success',
    1125                 message: sprintf(
    1126                     /* translators: %s: The refresh link's attributes. */
    1127                     __( 'Plugin activated. Some changes may not occur until you refresh the page. <a %s>Refresh Now</a>' ),
    1128                     'href="#" class="button button-secondary refresh-page"'
    1129                 ),
    1130                 slug: response.slug
    1131             },
    1132             noticeTarget;
    1133 
    1134         wp.a11y.speak( __( 'Activation completed successfully. Some changes may not occur until you refresh the page.' ) );
     1120            );
     1121
     1122        wp.a11y.speak( __( 'Activation completed successfully.' ) );
    11351123        $document.trigger( 'wp-plugin-activate-success', response );
    11361124
     
    11411129            .text( buttonText );
    11421130
    1143         if ( isInModal ) {
     1131        if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
    11441132            wp.updates.setCardButtonStatus(
    11451133                {
     
    11521140                }
    11531141            );
    1154 
    1155             // Add a notice to the modal's footer.
    1156             $message.replaceWith( wp.updates.adminNotice( noticeData ) );
    1157 
    1158             // Send notice information back to the parent screen.
    1159             noticeTarget = window.parent === window ? null : window.parent;
    1160             $.support.postMessage = !! window.postMessage;
    1161             if ( false !== $.support.postMessage && null !== noticeTarget && -1 === window.parent.location.pathname.indexOf( 'index.php' ) ) {
    1162                 noticeTarget.postMessage(
    1163                     JSON.stringify( noticeData ),
    1164                     window.location.origin
    1165                 );
    1166             }
    1167         } else {
    1168             // Add a notice to the top of the screen.
    1169             wp.updates.addAdminNotice( noticeData );
    11701142        }
    11711143
    11721144        setTimeout( function() {
    1173             if ( isInModal ) {
     1145            $message.removeClass( 'activated-message' )
     1146            .text( _x( 'Active', 'plugin' ) );
     1147
     1148            if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
    11741149                wp.updates.setCardButtonStatus(
    11751150                    {
     
    11851160                    }
    11861161                );
    1187             } else {
    1188                 $message.removeClass( 'activated-message' ).text( _x( 'Active', 'plugin' ) );
    11891162            }
    11901163        }, 1000 );
     
    32293202            }
    32303203
    3231             if ( 'undefined' !== typeof message.id && 'plugin-activated-successfully' === message.id ) {
    3232                 wp.updates.addAdminNotice( message );
    3233                 return;
    3234             }
    3235 
    32363204            if (
    32373205                'undefined' !== typeof message.status &&
     
    34663434            }
    34673435        );
    3468 
    3469         /**
    3470          * Click handler for page refresh link.
    3471          *
    3472          * @since 6.5.3
    3473          *
    3474          * @param {Event} event Event interface.
    3475          */
    3476         $document.on( 'click', '.refresh-page', function( event ) {
    3477             event.preventDefault();
    3478 
    3479             if ( window.parent === window ) {
    3480                 window.location.reload();
    3481             } else {
    3482                 window.parent.location.reload();
    3483             }
    3484         } );
    34853436    } );
    34863437})( jQuery, window.wp, window._wpUpdatesSettings );
  • branches/6.5/src/wp-admin/css/common.css

    r58083 r58258  
    15141514}
    15151515
    1516 #plugin-information-footer #plugin-activated-successfully {
    1517     margin-bottom: 0;
    1518 }
    1519 
    1520 #plugin-information-footer #plugin-activated-successfully p {
    1521     display: flex;
    1522     gap: 1em;
    1523     align-items: center;
    1524     justify-content: space-between;
    1525     margin: 0;
    1526 }
    1527 
    1528 #plugin-information-footer #plugin-activated-successfully .refresh-page {
    1529     flex-grow: 0;
    1530     line-height: 2.15384615;
    1531     min-height: 0;
    1532     margin-bottom: 0;
    1533 }
    1534 
    15351516.update-message p:before,
    15361517.updating-message p:before,
Note: See TracChangeset for help on using the changeset viewer.