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

Templates API: return post modified datetime in response #4613

Closed

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Jun 14, 2023

Adding 'modified' field and value (if available) to template rest APIcontroller

Synching Core with:

Trac ticket: https://core.trac.wordpress.org/ticket/58540


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…troller.php

Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @ramonjd, Left some feedback.

@@ -926,6 +935,13 @@ public function get_item_schema() {
'type' => 'integer',
'context' => array( 'view', 'edit', 'embed' ),
),
'modified' => array(
'description' => __( "The date the template was last modified, in the site's timezone." ),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'description' => __( "The date the template was last modified, in the site's timezone." ),
'description' => __( 'The date the template was last modified, in the site's timezone.' ),

Copy link
Member Author

@ramonjd ramonjd Jun 15, 2023

Choose a reason for hiding this comment

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

The double quote are there because of the single quotes in site's. I can update the language to avoid the apostrophe if you think it's better.

I copied it from WP_REST_Posts_Controller

Copy link
Member

Choose a reason for hiding this comment

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

Ohh leave it then or you can update like below.

__( 'The date the template was last modified, in the site\'s timezone.' )

@ramonjd ramonjd changed the title [WIP] Templates API: return post modified datetime in response Templates API: return post modified datetime in response Jun 20, 2023
@TimothyBJacobs TimothyBJacobs self-requested a review June 22, 2023 15:36
Copy link
Member

@TimothyBJacobs TimothyBJacobs left a comment

Choose a reason for hiding this comment

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

LGTM

@tellthemachines
Copy link
Contributor

Committed in r55992 / 09a7c68.

ramonjd added a commit to ramonjd/wordpress-develop that referenced this pull request Jun 23, 2023
…lt_from_post

The wrong object was used in the template part assertion.

This commit corrects that.
@ramonjd
Copy link
Member Author

ramonjd commented Jun 23, 2023

Sorry @tellthemachines and @TimothyBJacobs

I just realized I added a breaking change to PHP unit tests on this line:

https://github.com/WordPress/wordpress-develop/pull/4613/files#diff-d5470ce0db8dafe9e9d34bc2dd1e9c5d3f67bdfd365427b91a0ab438b0382314R121

It'll cause the tests to fail sometimes (when they don't run fast enough 😄 )

Fix here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

5 participants