Skip to content
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

URL watcher notification changes #10089

Merged
merged 13 commits into from
Jun 22, 2018
Merged

Conversation

jdevalk
Copy link
Contributor

@jdevalk jdevalk commented Jun 20, 2018

Summary

This pull includes the changes in #10077, but makes some changes:

  • Removes the watcher for slug changes as core actually handles that nicely
  • Adds branding to the other notifications and improves the messaging
  • Makes the notifications dismissible

This PR can be summarized in the following changelog entry:

  • none needed.

Relevant technical choices:

  • Added an option to the notification class to add yoast branding.

Test instructions

This PR can be tested by following these steps:

  • Delete or trash a post, see notification.
  • Change slug on a post, see no notification, also notices core handles it without pain.

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

Fixes https://github.com/Yoast/wordpress-seo-premium/issues/1798

@jdevalk jdevalk changed the base branch from trunk to release/7.7 June 20, 2018 11:19
Copy link
Contributor

@jcomack jcomack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR done 🏗

@@ -62,6 +62,7 @@ class Yoast_Notification {
'dismissal_key' => null,
'capabilities' => array(),
'capability_check' => self::MATCH_ALL,
'yoast-branding' => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the - should be a _.

if ( $this->options['yoast-branding'] ) {
$message = $this->wrap_yoast_seo_icon( $this->message );
}
if ( ! isset( $message ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing whitespace above this line.

@@ -282,8 +283,36 @@ public function render() {
// Combined attribute key and value into a string.
array_walk( $attributes, array( $this, 'parse_attributes' ) );

if ( $this->options['yoast-branding'] ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment regarding the usage of -.

*
* @param string $message The message to wrap.
*
* @return string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation.

60,
60
);
$out .= '<div class="yoast-seo-icon-wrap">';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make these three lines part of the sprintf?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided not to fix this, because the sprintf is about the image tag being parsed

*
* @param string $first_sentence The first sentence of the notification.
*
* @return string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation.

protected function get_message( $first_sentence ) {
return '<h2>' . __( 'Make sure your visitors don\'t get errors!', 'wordpress-seo' ) . '</h2>'
. '<p>'
/* translators: %1$s expands to the translated name of the post type, %2$s expands to the anchor opening tag, %3$s to the anchor closing tag. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this comment won't be parsed properly by gettext.

/**
* Adds a notification to be shown on the next page request since posts are updated in an ajax request.
*
* @param string $post_type_label The singular_name label from a post_type_object.
* @param string $message The singular_name label from a post_type_object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this documentation still correct as the variable name changed to $message?

), array( 'type' => 'notice-info' )
$message, array(
'type' => 'notice-warning is-dismissible',
'yoast-branding' => true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment regarding the usage of - vs _.

@@ -41,6 +41,7 @@ public function test_set_defaults() {
'dismissal_key' => null,
'capabilities' => array( 'wpseo_manage_options' ),
'capability_check' => 'all',
'yoast-branding' => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment regarding the usage of - vs _.

Copy link
Contributor

@jcomack jcomack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR 2 done 👍

@jcomack
Copy link
Contributor

jcomack commented Jun 22, 2018

Acceptance done.

I'm not sure how I feel about the notification. When you delete a post, you get redirected to the posts overview. This is fine, however the notification states "You just trashed this Post [...]". My immediate reaction to such a message was "What post exactly?". I'm fairly certain I won't be the only person that thinks this.

@CarolineGeven
Copy link
Contributor

Acceptance done. Will check with @jdevalk about suggested copy change.

@CarolineGeven CarolineGeven merged commit 8e0b3c4 into release/7.7 Jun 22, 2018
@CarolineGeven CarolineGeven deleted the jdv/slug-watcher-changes branch June 22, 2018 09:25
@CarolineGeven CarolineGeven mentioned this pull request Jun 22, 2018
2 tasks
@andizer andizer added this to the 7.7 milestone Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants