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

Show notice every 4 weeks #43

Merged
merged 17 commits into from
Aug 4, 2017
Merged

Show notice every 4 weeks #43

merged 17 commits into from
Aug 4, 2017

Conversation

andizer
Copy link

@andizer andizer commented Aug 3, 2017

Instead of checking on major WP Version change we are now showing the notice every 4 weeks.

Test instructions

Fixes #42

}

/**
* Returns the value of the whip_dismissed option.
*
* @return string Returns the value of the option or an empty string when not set.
* @return string|int Returns the value of the option or an empty string when not set.
Copy link
Contributor

Choose a reason for hiding this comment

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

As we are saving a timestamp, we should just return an int and cast the stored value to int when returning it.

$parts = explode( '.', $versionToConvert, 3 );

return implode( '.', array_slice( $parts, 0, 2 ) );
return ( ( $this->storage->get() + $this->threshold ) > $this->currentTime );
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this pretty hard to read.
Prefer to make it better readable by flipping the variables around a bit:
( $this->currentTime <= ( $this->storage->get() + $this->threshold ) )

The description of the method should follow the logic.
Checks if the current time is lower than the stored time extended by the threshold.

@@ -11,23 +11,23 @@ class Whip_WPDismissOption implements Whip_DismissStorage {
/**
* Saves the value to the options.
*
* @param string $dismissedVersion The value to save.
* @param string $dismissedValue The value to save.
Copy link
Contributor

Choose a reason for hiding this comment

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

As we are saving a timestamp, this can be an int

@@ -48,9 +48,10 @@ public function renderMessage() {

/* translators: 1: is a link to dismiss url 2: closing link tag */
$dismissButton = sprintf(
__( '<p>%1$sRemind me again after the next WordPress release.%2$s</p>', 'wordpress' ),
__( '<p>%1$sRemind me again after %3$d weeks.%2$s</p>', 'wordpress' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

The number can be hard-coded, as it will not change.

@@ -48,7 +48,7 @@ public function renderMessage() {

/* translators: 1: is a link to dismiss url 2: closing link tag */
$dismissButton = sprintf(
__( '<p>%1$sRemind me again after the next WordPress release.%2$s</p>', 'wordpress' ),
__( '<p>%1$sRemind me again after 4 weeks.%2$s</p>', 'wordpress' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the <p> tags from the translation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please change after to in

Change the `after` to an `in`
@jcomack
Copy link
Contributor

jcomack commented Aug 4, 2017

CR & Acceptance done 👍

@jcomack jcomack merged commit a6823f4 into master Aug 4, 2017
@jcomack jcomack deleted the 42-show-notice-every-4-weeks branch August 4, 2017 08:45
@jrfnl jrfnl added this to the 1.1.0 milestone Nov 9, 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.

4 participants