Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 889 forks source link

The intro admin notice keeps coming back #2634

Closed szepeviktor closed 8 years ago

szepeviktor commented 9 years ago

After updating the 2.2.1 the admin notice with the intro link in it keeps appearing until I click the intro link. Closing with the X closes it momentarily but on the next admin page load it appears again.

szepeviktor commented 9 years ago

WP 4.1.1

Rarst commented 9 years ago

Please elaborate on your report, following these guidelines.

Any JS or PHP errors in particular?

Does it happen if you disable other plugins / switch to default theme?

szepeviktor commented 9 years ago

Diving into wpseo_dismiss_about...

szepeviktor commented 9 years ago

On a pristine WP I do not receive the output of die( '1' ); from wpseo_dismiss_about(). But wpseo_seen_about_version is created and the admin notice does not appear again. It is HTTP/200.

szepeviktor commented 9 years ago

wpseo_seen_about_version is created on the live site also, so it is OK. Maybe this notice cannot be hidden on the plugin update page.

szepeviktor commented 9 years ago

Should I expect that '1' in the response?

szepeviktor commented 9 years ago

Excuse me. Firefox Developer version did not understand 1 as JSON. But the response's content type is text/html.

Rarst commented 9 years ago

I assume you had figured out what was causing it to close the issue? :) What was it for our information?

szepeviktor commented 9 years ago

:smiley: I think I've navigated to another admin page before that AJAX request - thus the user meta update - was committed.

szepeviktor commented 9 years ago

On another site, on this URL */wp-admin/post.php?post=1906&action=edit when I click notice-dismiss no AJAX is fired. Empty browser console.

szepeviktor commented 9 years ago

Maybe Firefox 41 is the cause?

szepeviktor commented 9 years ago

Closing the notice for the ~20th time, I've got an empty (no parameters, no response) AJAX request and the notice is gone. How to debug it? After deleting the user-meta, wpseo_dismiss_about is fired for the first time on close button click.

omarreiss commented 9 years ago

In WP installs < 4.2, we include a script that adds the dismiss button to notices. I think the issue might be that this script is either not available or not working properly. I think the issue could be that I am using a restricted keyword event as an argument for a closure. This will probably not work in some versions of Firefox and Internet Explorer. I will create a PR that fixes this. @szepeviktor could you verify you don't have the issue in Chrome?

omarreiss commented 9 years ago

On the other hand, it seems the minified JavaScript doesn't contain the restricted keyword and I can infer from your earlier provided details the necessary Javascripts are being included (you are running WP 4.1.1 and you are seeing a dismiss button).

I will have to start debugging in Firefox to see if I can reproduce. Removing the bug label since I am not convinced it's a bug anymore.

szepeviktor commented 9 years ago

On another installation wp-admin/update-core.php (WP 4.1.1) only the jQuery(this).remove() is bound, no AJAX is fired on close.

szepeviktor commented 9 years ago

As I would execute it, I comment after lines:

function wpseoMakeDismissible() {
    jQuery( '.notice.is-dismissible' ).each( function() {
        // find the notice <div>
        var $notice = jQuery( this );
                // store it in $notice
        if ( $notice.find( '.notice-dismiss').empty() ) {
                // remove the <button> from the notice
            var $button = jQuery( '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>' );

            $notice.append( $button );
                        // replace with this button

            $button.on( 'click.wp-dismiss-notice', function( event ) {
                        // bind to this new button
                event.preventDefault();
                $notice.fadeTo( 100 , 0, function() {
                    jQuery(this).slideUp( 100, function() {
                        jQuery(this).remove();
                    });
                });
            });
        }
    });
}

wpseoMakeDismissible() and wpseoDismissAbout() both run on document ready. I think sometime one, some other times the other runs first. In my case wpseoDismissAbout() could bind the AJAX event on the removed button. @omarreiss I hope this helps.

omarreiss commented 9 years ago

@szepeviktor thanks, that looks like an excellent lead. I will look into it as soon as I find time :wink:

Rarst commented 8 years ago

Notifications had been refactored, old issues no longer relevant.