-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display the "blog not public" notification where relevant #14690
Conversation
Moving back to Needs Action, pending feedback. |
@afercia I agree with 'For these reasons I'd suggest to use plain text and remove both the strong and the link' Let's exclude HTML for the Gutenberg notice |
@afercia With #14566 (comment) your question about where the code for the notices should be placed becomes obsolete. I'm working on some big refactors for how the JavaScript in Yoast SEO is organized. I'll take this into account when doing that so it becomes more intuitive where to put that code in the future. |
Thanks both for your feedback. Well at least we now have some knowledge on how to add notices to Gutenberg 🙂 Will continue to work on this tomorrow and make the notice show only where specified. |
Note: the Travis build is failing for unrelated changes (JS snapshots not updated) |
|
CR & Acceptance: 👍 |
Note: I think the removal of the old notification in the Notification Center is suffering from the same problem described on #14828 (comment) Will re-test and fix if need be. |
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
ignore_search_engines_discouraged_notice
optionblog_public_notice()
Decisions to be made:
Update: decisions were made. Please skip this part and jump tp Test Instructions.
Before I add test instructions and before CR / acceptance, there are a couple things I need feedback from product / architects related to the notice displayed in Gutenberg:1: For product: Consider to not use HTML for the Gutenberg notice
Our notice copy is supposed to contain some strong text and a link to the Reading Settings page. A custom component for the notice text would be cool but the Gutenberg notices don't allow components to be passed for their content, which is meh 😞 The message passed to the
createNotice
action is casted to a string: https://github.com/WordPress/gutenberg/blob/c5fab6d23ff7478096942412bc20dc30654ca82e/packages/notices/src/store/actions.js#L57-L60By using
__unstableHTML
the string can contain HTML, with two downsides:For these reasons I'd suggest to use plain text and remove both the strong and the link.
Notice with HTML in WordPress 5.3:
Notice with HTML in WordPress 5.4 with the Gutenberg plugin activated:
Notice with no HTML:
1: For Software architects: Where the new code should be placed
For now, I put the new code within
js/src/edit.js
. This doesn't seem ideal to me for a couple reasons:However, I couldn't think of a proper place. This isn't exactly a "component". It uses
wp.data.dispatch( "core/notices" )
and relatedcreateNotice
action. Any idea where to put such a thing?Test instructions
This PR can be tested by following these steps:
wp_options
table >wpseo
option, there's a value"ignore_search_engines_discouraged_notice";b:1;
Note: if you need to make the admin notice appear again for testing purposes, put this code somewhere in a place where it is executed:
WPSEO_Options::set( 'ignore_search_engines_discouraged_notice', false );
UI changes
Documentation
Quality assurance
Fixes #14566