-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Me: Adds ability to toggle holiday snow #1138
Conversation
+1 to make for a cleaner UI the rest of the year. Let's not let our options interface get out of control. |
Testing notes:
|
I can confirm that the user setting overrides a site-specific setting, as expected. |
I just pushed up another commit that puts the holiday snow checkbox behind a date check. It should also be future-proof. 😄 I tested by setting the year for the @lancewillett The API still uses the same meta value as Also, for what it's worth, when |
@ebinnion API — OK, sounds good. For the dates — is it really future-proof if it uses 2015 in the string? Will that work next winter, too, without a code change? |
In regards to the dates, it should be future proof. Explanation:
To create a moment, we need to pass it a proper string (otherwise I was getting deprecation notices) that looks like So, |
Got it! Thanks. Testing things out — looks great. 🚢 |
Me: Adds ability to toggle holiday snow
What happens on January 2nd, 2016 for example? Unless I'm overlooking something, your code won't work. The correct logic would be something like this: let startDate = this.moment( '2015-12-1' ).year( thisYear ),
endDate = this.moment( '2015-01-04' ).year( thisYear );
if ( today < startDate && today > endDate ) {
return;
} Note: I have no idea how In short, if today is after this year's January 4th and before this year's December 1st, don't display it. |
Additionally perhaps we should control this on the REST API side of things so that if we decide to change either of the dates in the PHP code, the change is reflected in Calypso as well. There's talk of extending it to the 6th for example. |
Thanks for pointing that out @Viper007Bond. So, to clarify, the solution would have worked for future years, it just would've hid the checkbox early when January came around. In regards to relying on the API for the start and end date, those dates are also hard coded in Jetpack. Since those dates are hard coded in Jetpack as well, I think we should move forward with this PR. |
In #1123, @jeherve reported that the holiday snow option was not displayed within
/me
. This PR allows a user to toggle holiday snow.Since holiday snow only displays from 12-1 to 1-4, we could also feature flag or time flag this option.
Instead of presenting a checkbox that allowed a user to "disable", as opposed to "enable" a feature, I modified the
/me/settings
endpoint in r127611-wpcom to reverse the logic for holiday snow.To test:
update/me-holiday-snow
$site/wp-admin/options-general.php
and ensure holiday snow is turned on/me/account