<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57366] trunk: Editor: Add original_source and author_text to the templates REST API.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57366">57366</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57366","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorgefilipecosta</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-01-27 00:05:24 +0000 (Sat, 27 Jan 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Add original_source and author_text to the templates REST API.

For the new "All templates" UI to work properly we need the REST API to provide to additional fields original_source, and author_text.

Props ntsekouras, get_dave.
Fixes <a href="https://core.trac.wordpress.org/ticket/60358">#60358</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestTemplateAutosavesControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestTemplateRevisionsControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestTemplateRevisionsController.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestTemplatesControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php   2024-01-26 17:51:37 UTC (rev 57365)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php     2024-01-27 00:05:24 UTC (rev 57366)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -726,6 +726,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $data['modified'] = mysql_to_rfc3339( $template->modified );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( rest_is_field_included( 'author_text', $fields ) ) {
+                       $data['author_text'] = self::get_wp_templates_author_text_field( $template );
+               }
+
+               if ( rest_is_field_included( 'original_source', $fields ) ) {
+                       $data['original_source'] = self::get_wp_templates_original_source_field( $template );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
</span><span class="cx" style="display: block; padding: 0 10px">                $data    = $this->add_additional_fields_to_object( $data, $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data    = $this->filter_response_by_context( $data, $context );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -748,8 +756,87 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $response;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Returns the source from where the template originally comes from.
+        *
+        * @access private
+        * @internal
+        *
+        * @param WP_Block_Template $template_object Template instance.
+        * @return string                            Original source of the template one of theme, plugin, site, or user.
+        */
+       private static function get_wp_templates_original_source_field( $template_object ) {
+               if ( 'wp_template' === $template_object->type || 'wp_template_part' === $template_object->type ) {
+                       // Added by theme.
+                       // Template originally provided by a theme, but customized by a user.
+                       // Templates originally didn't have the 'origin' field so identify
+                       // older customized templates by checking for no origin and a 'theme'
+                       // or 'custom' source.
+                       if ( $template_object->has_theme_file &&
+                       ( 'theme' === $template_object->origin || (
+                               empty( $template_object->origin ) && in_array(
+                                       $template_object->source,
+                                       array(
+                                               'theme',
+                                               'custom',
+                                       ),
+                                       true
+                               ) )
+                       )
+                       ) {
+                               return 'theme';
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        // Added by plugin.
+                       if ( $template_object->has_theme_file && 'plugin' === $template_object->origin ) {
+                               return 'plugin';
+                       }
+
+                       // Added by site.
+                       // Template was created from scratch, but has no author. Author support
+                       // was only added to templates in WordPress 5.9. Fallback to showing the
+                       // site logo and title.
+                       if ( empty( $template_object->has_theme_file ) && 'custom' === $template_object->source && empty( $template_object->author ) ) {
+                               return 'site';
+                       }
+               }
+
+               // Added by user.
+               return 'user';
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Returns a human readable text for the author of the template.
+        *
+        * @access private
+        * @internal
+        *
+        * @param WP_Block_Template $template_object Template instance.
+        * @return string                            Human readable text for the author.
+        */
+       private static function get_wp_templates_author_text_field( $template_object ) {
+               $original_source = self::get_wp_templates_original_source_field( $template_object );
+               switch ( $original_source ) {
+                       case 'theme':
+                               $theme_name = wp_get_theme( $template_object->theme )->get( 'Name' );
+                               return empty( $theme_name ) ? $template_object->theme : $theme_name;
+                       case 'plugin':
+                               $plugins = get_plugins();
+                               $plugin  = $plugins[ plugin_basename( sanitize_text_field( $template_object->theme . '.php' ) ) ];
+                               return empty( $plugin['Name'] ) ? $template_object->theme : $plugin['Name'];
+                       case 'site':
+                               return get_bloginfo( 'name' );
+                       case 'user':
+                               $author = get_user_by( 'id', $template_object->author );
+                               if ( ! $author ) {
+                                       return __( 'Unknown author' );
+                               }
+                               return $author->get( 'display_name' );
+               }
+       }
+
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Prepares links for the request.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.8.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -861,13 +948,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'title'      => $this->post_type,
</span><span class="cx" style="display: block; padding: 0 10px">                        'type'       => 'object',
</span><span class="cx" style="display: block; padding: 0 10px">                        'properties' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'ID of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'slug'           => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'slug'            => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Unique slug identifying the template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -875,29 +962,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'minLength'   => 1,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'pattern'     => '[a-zA-Z0-9_\%-]+',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'theme'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'theme'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Theme identifier for the template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'type'           => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'type'            => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Type of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'source'         => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'source'          => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Source of template' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'origin'         => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'origin'          => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Source of a customized template' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'content'        => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'content'         => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Content of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => array( 'object', 'string' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'default'     => '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -916,7 +1003,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Title of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => array( 'object', 'string' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'default'     => '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -935,13 +1022,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'description'    => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'description'     => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Description of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'default'     => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Status of template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'enum'        => array_keys( get_post_stati( array( 'internal' => false ) ) ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -948,24 +1035,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'default'     => 'publish',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'wp_id'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'wp_id'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Post ID.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'has_theme_file' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'has_theme_file'  => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'Theme file exists.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'bool',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'embed', 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'author'         => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'author'          => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( 'The ID for the author of the template.' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'view', 'edit', 'embed' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'modified'       => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'modified'        => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'description' => __( "The date the template was last modified, in the site's timezone." ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'string',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'format'      => 'date-time',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -972,6 +1059,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'readonly'    => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'author_text'     => array(
+                                       'type'        => 'string',
+                                       'description' => __( 'Human readable text for the author.' ),
+                                       'readonly'    => true,
+                                       'context'     => array( 'view', 'edit', 'embed' ),
+                               ),
+                               'original_source' => array(
+                                       'description' => __( 'Where the template originally comes from e.g. \'theme\'' ),
+                                       'type'        => 'string',
+                                       'readonly'    => true,
+                                       'context'     => array( 'view', 'edit', 'embed' ),
+                                       'enum'        => array(
+                                               'theme',
+                                               'plugin',
+                                               'site',
+                                               'user',
+                                       ),
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestTemplateAutosavesControllerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php  2024-01-26 17:51:37 UTC (rev 57365)
+++ trunk/tests/phpunit/tests/rest-api/wpRestTemplateAutosavesController.php    2024-01-27 00:05:24 UTC (rev 57366)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -310,7 +310,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $properties = $data['schema']['properties'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertCount( 16, $properties );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertCount( 18, $properties );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( 'id', $properties, 'ID key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'slug', $properties, 'Slug key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'theme', $properties, 'Theme key should exist in properties.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -326,6 +326,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'modified', $properties, 'modified key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'is_custom', $properties, 'is_custom key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'parent', $properties, 'Parent key should exist in properties.' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertArrayHasKey( 'author_text', $properties, 'Parent key should exist in properties.' );
+               $this->assertArrayHasKey( 'original_source', $properties, 'Parent key should exist in properties.' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestTemplateRevisionsControllerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/wpRestTemplateRevisionsController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestTemplateRevisionsController.php  2024-01-26 17:51:37 UTC (rev 57365)
+++ trunk/tests/phpunit/tests/rest-api/wpRestTemplateRevisionsController.php    2024-01-27 00:05:24 UTC (rev 57366)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -449,7 +449,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $data       = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px">                $properties = $data['schema']['properties'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertCount( 16, $properties );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertCount( 18, $properties );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( 'id', $properties, 'ID key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'slug', $properties, 'Slug key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'theme', $properties, 'Theme key should exist in properties.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -465,6 +465,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'modified', $properties, 'modified key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'is_custom', $properties, 'is_custom key should exist in properties.' );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'parent', $properties, 'Parent key should exist in properties.' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertArrayHasKey( 'author_text', $properties, 'Parent key should exist in properties.' );
+               $this->assertArrayHasKey( 'original_source', $properties, 'Parent key should exist in properties.' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestTemplatesControllerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php  2024-01-26 17:51:37 UTC (rev 57365)
+++ trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php    2024-01-27 00:05:24 UTC (rev 57366)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,23 +102,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//my_template',
-                               'theme'          => 'default',
-                               'slug'           => 'my_template',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Description of my template.',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//my_template',
+                               'theme'           => 'default',
+                               'slug'            => 'my_template',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Description of my template.',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'wp_id'          => self::$post->ID,
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => 0,
-                               'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'wp_id'           => self::$post->ID,
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => 0,
+                               'modified'        => mysql_to_rfc3339( self::$post->post_modified ),
+                               'author_text'     => 'Test Blog',
+                               'original_source' => 'site',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->find_and_normalize_template_by_id( $data, 'default//my_template' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -147,23 +149,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//my_template',
-                               'theme'          => 'default',
-                               'slug'           => 'my_template',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Description of my template.',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//my_template',
+                               'theme'           => 'default',
+                               'slug'            => 'my_template',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Description of my template.',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'wp_id'          => self::$post->ID,
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => 0,
-                               'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'wp_id'           => self::$post->ID,
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => 0,
+                               'modified'        => mysql_to_rfc3339( self::$post->post_modified ),
+                               'author_text'     => 'Test Blog',
+                               'original_source' => 'site',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -184,23 +188,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//my_template',
-                               'theme'          => 'default',
-                               'slug'           => 'my_template',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Description of my template.',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//my_template',
+                               'theme'           => 'default',
+                               'slug'            => 'my_template',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Description of my template.',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'wp_id'          => self::$post->ID,
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => 0,
-                               'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'wp_id'           => self::$post->ID,
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => 0,
+                               'modified'        => mysql_to_rfc3339( self::$post->post_modified ),
+                               'author_text'     => 'Test Blog',
+                               'original_source' => 'site',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -241,26 +247,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $data     = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['content'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['_links'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $author_name = get_user_by( 'id', self::$admin_id )->get( 'display_name' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSameSetsWithIndex(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => "{$theme_dir}//{$template}",
-                               'theme'          => $theme_dir,
-                               'slug'           => $template,
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => $args['post_excerpt'],
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => "{$theme_dir}//{$template}",
+                               'theme'           => $theme_dir,
+                               'slug'            => $template,
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => $args['post_excerpt'],
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => $args['post_title'],
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => $args['post_title'],
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'wp_id'          => $post->ID,
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => self::$admin_id,
-                               'modified'       => mysql_to_rfc3339( $post->post_modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'wp_id'           => $post->ID,
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => self::$admin_id,
+                               'modified'        => mysql_to_rfc3339( $post->post_modified ),
+                               'author_text'     => $author_name,
+                               'original_source' => 'user',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -421,27 +430,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $author_name = get_user_by( 'id', self::$admin_id )->get( 'display_name' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//my_custom_template',
-                               'theme'          => 'default',
-                               'content'        => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//my_custom_template',
+                               'theme'           => 'default',
+                               'content'         => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw' => 'Content',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'slug'           => 'my_custom_template',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Just a description',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'slug'            => 'my_custom_template',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Just a description',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => self::$admin_id,
-                               'modified'       => mysql_to_rfc3339( $modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => self::$admin_id,
+                               'modified'        => mysql_to_rfc3339( $modified ),
+                               'author_text'     => $author_name,
+                               'original_source' => 'user',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -469,27 +482,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $author_name = get_user_by( 'id', self::$admin_id )->get( 'display_name' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//404',
-                               'theme'          => 'default',
-                               'content'        => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//404',
+                               'theme'           => 'default',
+                               'content'         => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'slug'           => '404',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Template shown when no content is found.',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'slug'            => '404',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Template shown when no content is found.',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => '404',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => '404',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'has_theme_file' => false,
-                               'is_custom'      => false,
-                               'author'         => self::$admin_id,
-                               'modified'       => mysql_to_rfc3339( $modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'has_theme_file'  => false,
+                               'is_custom'       => false,
+                               'author'          => self::$admin_id,
+                               'modified'        => mysql_to_rfc3339( $modified ),
+                               'author_text'     => $author_name,
+                               'original_source' => 'user',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -521,27 +538,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $author_name = get_user_by( 'id', self::$admin_id )->get( 'display_name' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'id'             => 'default//my_custom_template_raw',
-                               'theme'          => 'default',
-                               'content'        => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'id'              => 'default//my_custom_template_raw',
+                               'theme'           => 'default',
+                               'content'         => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw' => 'Content',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'slug'           => 'my_custom_template_raw',
-                               'source'         => 'custom',
-                               'origin'         => null,
-                               'type'           => 'wp_template',
-                               'description'    => 'Just a description',
-                               'title'          => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'slug'            => 'my_custom_template_raw',
+                               'source'          => 'custom',
+                               'origin'          => null,
+                               'type'            => 'wp_template',
+                               'description'     => 'Just a description',
+                               'title'           => array(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'raw'      => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'rendered' => 'My Template',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status'         => 'publish',
-                               'has_theme_file' => false,
-                               'is_custom'      => true,
-                               'author'         => self::$admin_id,
-                               'modified'       => mysql_to_rfc3339( $modified ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'          => 'publish',
+                               'has_theme_file'  => false,
+                               'is_custom'       => true,
+                               'author'          => self::$admin_id,
+                               'modified'        => mysql_to_rfc3339( $modified ),
+                               'author_text'     => $author_name,
+                               'original_source' => 'user',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -700,7 +721,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $response   = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data       = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px">                $properties = $data['schema']['properties'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertCount( 15, $properties );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertCount( 17, $properties );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( 'id', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'description', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'slug', $properties );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -717,6 +738,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'is_custom', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'author', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'modified', $properties );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertArrayHasKey( 'author_text', $properties );
+               $this->assertArrayHasKey( 'original_source', $properties );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        protected function find_and_normalize_template_by_id( $templates, $id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -747,10 +770,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $request = new WP_REST_Request( 'POST', '/wp/v2/templates' );
</span><span class="cx" style="display: block; padding: 0 10px">                $request->set_body_params( $body_params );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $response             = rest_get_server()->dispatch( $request );
-               $data                 = $response->get_data();
-               $modified             = get_post( $data['wp_id'] )->post_modified;
-               $expected['modified'] = mysql_to_rfc3339( $modified );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $response                    = rest_get_server()->dispatch( $request );
+               $data                        = $response->get_data();
+               $modified                    = get_post( $data['wp_id'] )->post_modified;
+               $expected['modified']        = mysql_to_rfc3339( $modified );
+               $expected['author_text']     = get_user_by( 'id', self::$admin_id )->get( 'display_name' );
+               $expected['original_source'] = 'user';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>