-
Notifications
You must be signed in to change notification settings - Fork 4.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
PublishDateTimePicker: Retrieve all future posts in a given month #44540
PublishDateTimePicker: Retrieve all future posts in a given month #44540
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @GeoJunkie! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
@noisysocks I think you've been working in and around the Publish panel in 6.1 cycle. I wonder if you are able to review? |
Thanks for creating the PR @GeoJunkie Mike! |
Could you explain this logic? If there's 30 days in the month, then it isn't necessarily the case that fetching 30 posts will fill the calendar. It might be that there are multiple posts scheduled for a single day. I think it would make sense to simply update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! ❤️
ba9a222
to
6128229
Compare
Thanks for the review @noisysocks :)
That's true. So that we don't run into any issues with high-volume posting, should we set I'll definitely set the |
If we set |
71b97c4
to
f06f64c
Compare
Adding a note here that this fix also exposed a performance issue with how Jetpack handles the Hopefully that will be fixed before this makes it out, but wanted to identify a potential impact on sites with Jetpack Publicize. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. Thanks for working on this @GeoJunkie.
I did a little testing locally and all seemed well. Since I pushed my own changes though, could you please double check that everything is working as you expected? Then I can merge for you.
f1084b6
to
7ab9f50
Compare
Required for new editor dependency (date-fns)
Thanks @noisysocks, that looks great! I tested it out and it's working very well — and much more performant. I did update |
Perfect, thank you! And congrats on the first PR. |
What?
Updates
PublishDateTimePicker
to retrieve all posts scheduled for the month shown on the date picker.Why?
Currently, when retrieving scheduled posts for a given month, not all days of the month with scheduled posts are flagged. If there are more than 10 posts scheduled, it will only mark days for 10 posts, and will also omit some posts scheduled for the first or last day of the month (this behavior was reported at https://core.trac.wordpress.org/ticket/54784 ).
This has two causes:
/v2/posts
, theper_page
parameter is omitted. Since this defaults to 10, at most 10 scheduled posts for the given month are returned in the JSON response, and those are the only ones thePostSchedule
component will see.getDayOfTheMonth()
doesn't specify a time, so the current time is used and items scheduled before that time on the first day of the month and after that time on the last day of the month won't be included.How?
per_page
parameter to the call togetEntityRecords()
. This will be set to the number of days in the month.getDayOfTheMonth()
to set the first day's time to00:00:00
and the last day's time to23:59:59
.Testing Instructions
Screenshots or screencast
Testing with a post scheduled each day from October 1st - October 31st
Before
After