Revisions: Fix template revisions retrieval and sorting#76760
Conversation
… 'date' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +100 B (0%) Total Size: 7.66 MB
ℹ️ View Unchanged
|
| // Template revisions use the template REST API format, which exposes | ||
| // 'modified' instead of 'date'. | ||
| const revisionDateField = revisionKey === 'wp_id' ? 'modified' : 'date'; |
There was a problem hiding this comment.
Strictly speaking, I believe template revisions were not working correctly even before #76347 was merged, as they were not referencing the modified field.
There was a problem hiding this comment.
It's kind of weird that template revisions are doing something different.
|
Flaky tests detected in 6953a65. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23431766229
|
|
Sorry, @t-hamano! I'm mostly AFK this week and not sure when I'll get time to test PR properly. The |
|
Thank you so much for this! This is looking good to me. I think I'll merge this soon to get it in RC 2. It would be good to have an e2e test so we don't make this regression again, but we/I can follow-up with it. |
… 'date' (#76760) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 5421a77 |
… 'date' (#76760) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
This updates the pinned hash from the `gutenberg` from `3edafcc90fc4520939d69279e26ace69390582be` to `0d133bf7e7437d65d68a06551f3d613a7d8e4361`. The following changes are included: - Reset blockEditingModes on RESET_BLOCKS (WordPress/gutenberg#76529) - RTC: Remove stale wp_enable_real_time_collaboration option check (WordPress/gutenberg#76810) - RTC: Fix editor freeze when replacing code editor content (WordPress/gutenberg#76815) - Preferences: Hide collaboration options when RTC is not enabled (WordPress/gutenberg#76819) - Editor: Fix template revisions using 'modified' date field instead of 'date' (WordPress/gutenberg#76760) - `ControlWithError`: Connect validation messages to controls via `aria… (WordPress/gutenberg#76835) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/3edafcc90fc4520939d69279e26ace69390582be…0d133bf7e7437d65d68a06551f3d613a7d8e4361. Log created with: git log --reverse --format="- %s" 3edafcc90fc4520939d69279e26ace69390582be..0d133bf7e7437d65d68a06551f3d613a7d8e4361 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/trunk@62150 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `3edafcc90fc4520939d69279e26ace69390582be` to `0d133bf7e7437d65d68a06551f3d613a7d8e4361`. The following changes are included: - Reset blockEditingModes on RESET_BLOCKS (WordPress/gutenberg#76529) - RTC: Remove stale wp_enable_real_time_collaboration option check (WordPress/gutenberg#76810) - RTC: Fix editor freeze when replacing code editor content (WordPress/gutenberg#76815) - Preferences: Hide collaboration options when RTC is not enabled (WordPress/gutenberg#76819) - Editor: Fix template revisions using 'modified' date field instead of 'date' (WordPress/gutenberg#76760) - `ControlWithError`: Connect validation messages to controls via `aria… (WordPress/gutenberg#76835) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/3edafcc90fc4520939d69279e26ace69390582be…0d133bf7e7437d65d68a06551f3d613a7d8e4361. Log created with: git log --reverse --format="- %s" 3edafcc90fc4520939d69279e26ace69390582be..0d133bf7e7437d65d68a06551f3d613a7d8e4361 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/trunk@62150 git-svn-id: http://core.svn.wordpress.org/trunk@61432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
… 'date' (#76760) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
See #76347 (comment)
What?
This PR fixes an issue where the in-editor revision is not working correctly in templates.
Why?
wp_idas theirrevisionKeyinstead of the defaultid.WP_REST_Template_Revisions_Controllerreturns the template object format, which exposesmodifiedinstead ofdate. As a result, sorting revisions by date and displaying dates in the slider tooltip and restore notice were broken for templates (values wereundefined).How?
modifiedto_fieldsin all revision queries (revisions-slider.js,private-selectors.js,private-actions.js)modifiedfor sorting and date display whenrevisionKeyis'wp_id'(i.e. template post types), anddateotherwiseTesting Instructions
🤖 Generated with Claude Code