<!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>[24790] trunk: Revisions changes.</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 { 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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/24790">24790</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-07-24 06:08:14 +0000 (Wed, 24 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Revisions changes.
 * Eliminates the bloated Revisions meta box in favor of 'Revisions: #' in the publish box.
 * Adds ability to compare autosave to current post, when revisions are disabled.
 * Makes autosaves stand out visually, including "Restore This Autosave".

Also:
 * Adds missing capability check for restoring a revision.
 * When no revision matches the post's current modified time, avoid marking an autosave as 'current'.
 * Fixes wp_get_post_autosave() to return an autosave even when revisions are disabled.
 * Add 'check_enabled' arg to wp_get_post_revisions(); false avoids the wp_revisions_enabled() check.
 * Adds a responsive slider that is narrower for fewer versions. props markjaquith.

see <a href="http://core.trac.wordpress.org/ticket/24804">#24804</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminincludesajaxactionsphp">trunk/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunkwpadminincludesrevisionphp">trunk/wp-admin/includes/revision.php</a></li>
<li><a href="#trunkwpadminjsrevisionsjs">trunk/wp-admin/js/revisions.js</a></li>
<li><a href="#trunkwpadminrevisionphp">trunk/wp-admin/revision.php</a></li>
<li><a href="#trunkwpincludesrevisionphp">trunk/wp-includes/revision.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css  2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/css/wp-admin.css     2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -3539,7 +3539,7 @@
</span><span class="cx">  margin: 0 auto;
</span><span class="cx">  height: 0.8em;
</span><span class="cx">  top: 7px;
</span><del>-       width: 70%;
</del><ins>+        max-width: 70%;
</ins><span class="cx">   -moz-box-sizing: border-box;
</span><span class="cx">  -webkit-box-sizing: border-box;
</span><span class="cx">  box-sizing: border-box;
</span><span class="lines">@@ -3641,6 +3641,11 @@
</span><span class="cx"> .revisions-controls .author-card .date {
</span><span class="cx">  color: #777;
</span><span class="cx"> }
</span><ins>+
+.revisions-controls .author-card.autosave {
+       color: #d54e21;
+}
+
</ins><span class="cx"> .revisions-controls .author-card .author-name {
</span><span class="cx">  font-weight: bold;
</span><span class="cx"> }
</span><span class="lines">@@ -3663,8 +3668,8 @@
</span><span class="cx">  float: right;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.wp-slider {
-       width: 70%;
</del><ins>+.revisions-controls .wp-slider {
+       max-width: 70%;
</ins><span class="cx">   margin: 0 auto;
</span><span class="cx">  top: -3px;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php    2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/edit-form-advanced.php       2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -109,13 +109,30 @@
</span><span class="cx"> // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
</span><span class="cx"> require_once('./includes/meta-boxes.php');
</span><span class="cx"> 
</span><ins>+
+$publish_callback_args = null;
+if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
+       $revisions = wp_get_post_revisions( $post_ID );
+
+       // Check if the revisions have been upgraded
+       if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
+               _wp_upgrade_revisions_of_post( $post, $revisions );
+
+       // We should aim to show the revisions metabox only when there are revisions.
+       if ( count( $revisions ) > 1 ) {
+               reset( $revisions ); // Reset pointer for key()
+               $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
+               // add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
+       }
+}
+
</ins><span class="cx"> if ( 'attachment' == $post_type ) {
</span><span class="cx">  wp_enqueue_script( 'image-edit' );
</span><span class="cx">  wp_enqueue_style( 'imgareaselect' );
</span><span class="cx">  add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
</span><span class="cx">  add_action( 'edit_form_after_title', 'edit_form_image_editor' );
</span><span class="cx"> } else {
</span><del>-       add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
</del><ins>+        add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
</span><span class="lines">@@ -172,18 +189,6 @@
</span><span class="cx">          add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
-       $revisions = wp_get_post_revisions( $post_ID );
-
-       // Check if the revisions have been upgraded
-       if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
-               _wp_upgrade_revisions_of_post( $post, $revisions );
-
-       // We should aim to show the revisions metabox only when there are revisions.
-       if ( count( $revisions ) > 1 )
-               add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
-}
-
</del><span class="cx"> do_action('add_meta_boxes', $post_type, $post);
</span><span class="cx"> do_action('add_meta_boxes_' . $post_type, $post);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ajax-actions.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ajax-actions.php 2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/includes/ajax-actions.php    2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -2099,7 +2099,7 @@
</span><span class="cx">          wp_send_json_error();
</span><span class="cx"> 
</span><span class="cx">  // Really just pre-loading the cache here.
</span><del>-       if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
</del><ins>+        if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) )
</ins><span class="cx">           wp_send_json_error();
</span><span class="cx"> 
</span><span class="cx">  $return = array();
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php   2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/includes/meta-boxes.php      2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @param object $post
</span><span class="cx">  */
</span><del>-function post_submit_meta_box($post) {
</del><ins>+function post_submit_meta_box($post, $args = array() ) {
</ins><span class="cx">   global $action;
</span><span class="cx"> 
</span><span class="cx">  $post_type = $post->post_type;
</span><span class="lines">@@ -171,6 +171,24 @@
</span><span class="cx">  $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+if ( ! empty( $args['args']['revisions_count'] ) ) :
+       $revisions_to_keep = wp_revisions_to_keep( $post );
+?>
+<div class="misc-pub-section num-revisions">
+<?php
+       if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
+               echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ),
+                       number_format_i18n( $revisions_to_keep ) ) ) . '">';
+               printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' );
+               echo '</span>';
+       } else {
+               printf( 'Revisions: %s', '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
+       }
+?>
+       <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><?php _ex( 'Browse', 'revisions' ); ?></a>
+</div>
+<?php endif;
+
</ins><span class="cx"> if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
</span><span class="cx"> <div class="misc-pub-section curtime">
</span><span class="cx">  <span id="timestamp">
</span></span></pre></div>
<a id="trunkwpadminincludesrevisionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/revision.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/revision.php     2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/includes/revision.php        2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -32,9 +32,10 @@
</span><span class="cx">          return false;
</span><span class="cx"> 
</span><span class="cx">  // If comparing revisions, make sure we're dealing with the right post parent.
</span><del>-       if ( $compare_from && $compare_from->post_parent !== $post->ID )
</del><ins>+        // The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
+       if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
</ins><span class="cx">           return false;
</span><del>-       if ( $compare_to->post_parent !== $post->ID )
</del><ins>+        if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
</ins><span class="cx">           return false;
</span><span class="cx"> 
</span><span class="cx">  if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
</span><span class="lines">@@ -91,22 +92,35 @@
</span><span class="cx">  $revisions = $authors = array();
</span><span class="cx">  $now_gmt = time();
</span><span class="cx"> 
</span><del>-       $revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC' ) );
</del><ins>+        $revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false ) );
+       // If revisions are disabled, we only want autosaves and the current post.
+       if ( ! wp_revisions_enabled( $post ) ) {
+               foreach ( $revisions as $revision_id => $revision ) {
+                       if ( ! wp_is_post_autosave( $revision ) )
+                               unset( $revisions[ $revision_id ] );
+               }
+               $revisions = array( $post->ID => $post ) + $revisions;
+       }
+
</ins><span class="cx">   $show_avatars = get_option( 'show_avatars' );
</span><span class="cx"> 
</span><span class="cx">  cache_users( wp_list_pluck( $revisions, 'post_author' ) );
</span><span class="cx"> 
</span><ins>+       $can_restore = current_user_can( 'edit_post', $post->ID );
+
</ins><span class="cx">   foreach ( $revisions as $revision ) {
</span><span class="cx">          $modified = strtotime( $revision->post_modified );
</span><span class="cx">          $modified_gmt = strtotime( $revision->post_modified_gmt );
</span><del>-               $restore_link = str_replace( '&amp;', '&', wp_nonce_url(
-                       add_query_arg(
-                               array( 'revision' => $revision->ID,
-                                       'action' => 'restore' ),
-                                       admin_url( 'revision.php' )
-                       ),
-                       "restore-post_{$revision->ID}"
-               ) );
</del><ins>+                if ( $can_restore ) {
+                       $restore_link = str_replace( '&amp;', '&', wp_nonce_url(
+                               add_query_arg(
+                                       array( 'revision' => $revision->ID,
+                                               'action' => 'restore' ),
+                                               admin_url( 'revision.php' )
+                               ),
+                               "restore-post_{$revision->ID}"
+                       ) );
+               }
</ins><span class="cx"> 
</span><span class="cx">          if ( ! isset( $authors[ $revision->post_author ] ) ) {
</span><span class="cx">                  $authors[ $revision->post_author ] = array(
</span><span class="lines">@@ -116,9 +130,10 @@
</span><span class="cx">                  );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               $autosave = wp_is_post_autosave( $revision );
</del><ins>+                $autosave = (bool) wp_is_post_autosave( $revision );
</ins><span class="cx">           $current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
</span><span class="cx">          if ( $current && ! empty( $current_id ) ) {
</span><ins>+                       // If multiple revisions have the same post_modified_gmt, highest ID is current.
</ins><span class="cx">                   if ( $current_id < $revision->ID ) {
</span><span class="cx">                          $revisions[ $current_id ]['current'] = false;
</span><span class="cx">                          $current_id = $revision->ID;
</span><span class="lines">@@ -138,14 +153,24 @@
</span><span class="cx">                  'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
</span><span class="cx">                  'autosave'   => $autosave,
</span><span class="cx">                  'current'    => $current,
</span><del>-                       'restoreUrl' => urldecode( $restore_link ),
</del><ins>+                        'restoreUrl' => $can_restore ? $restore_link : false,
</ins><span class="cx">           );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  // If a post has been saved since the last revision (no revisioned fields were changed)
</span><span class="cx">  // we may not have a "current" revision. Mark the latest revision as "current".
</span><del>-       if ( empty( $current_id ) )
-               $revisions[ $revision->ID ]['current'] = true;
</del><ins>+        if ( empty( $current_id ) ) {
+               if ( $revisions[ $revision->ID ]['autosave'] ) {
+                       $revision = end( $revisions );
+                       while ( $revision['autosave'] ) {
+                               $revision = prev( $revisions );
+                       }
+                       $current_id = $revision['id'];
+               } else {
+                       $current_id = $revision->ID;
+               }
+               $revisions[ $current_id ]['current'] = true;
+       }
</ins><span class="cx"> 
</span><span class="cx">  // Now, grab the initial diff
</span><span class="cx">  $compare_two_mode = is_numeric( $from );
</span></span></pre></div>
<a id="trunkwpadminjsrevisionsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/revisions.js (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/revisions.js   2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/js/revisions.js      2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -651,9 +651,11 @@
</span><span class="cx">                  var tickCount, tickWidth;
</span><span class="cx">                  tickCount = this.model.revisions.length - 1;
</span><span class="cx">                  tickWidth = 1 / tickCount;
</span><ins>+                       this.$el.css('width', ( this.model.revisions.length * 50 ) + 'px');
</ins><span class="cx"> 
</span><span class="cx">                  _(tickCount).times( function( index ){
</span><del>-                               this.$el.append( '<div style="' + this.direction + ': ' + ( 100 * tickWidth * index ) + '%"></div>' ); }, this );
</del><ins>+                                this.$el.append( '<div style="' + this.direction + ': ' + ( 100 * tickWidth * index ) + '%"></div>' );
+                       }, this );
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="lines">@@ -831,6 +833,7 @@
</span><span class="cx">          },
</span><span class="cx"> 
</span><span class="cx">          ready: function() {
</span><ins>+                       this.$el.css('width', ( this.model.revisions.length * 50 ) + 'px');
</ins><span class="cx">                   this.$el.slider( _.extend( this.model.toJSON(), {
</span><span class="cx">                          start: this.start,
</span><span class="cx">                          slide: this.slide,
</span></span></pre></div>
<a id="trunkwpadminrevisionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/revision.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/revision.php      2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-admin/revision.php 2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">  if ( ! $post = get_post( $revision->post_parent ) )
</span><span class="cx">          break;
</span><span class="cx"> 
</span><del>-       // Revisions disabled (previously checked autosavegs && ! wp_is_post_autosave( $revision ))
</del><ins>+        // Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
</ins><span class="cx">   if ( ! wp_revisions_enabled( $post ) ) {
</span><span class="cx">          $redirect = 'edit.php?post_type=' . $post->post_type;
</span><span class="cx">          break;
</span><span class="lines">@@ -133,14 +133,23 @@
</span><span class="cx"> <script id="tmpl-revisions-tooltip" type="text/html">
</span><span class="cx">  <div class="author-card">
</span><span class="cx">  <# if ( 'undefined' !== typeof data && 'undefined' !== typeof data.author ) { #>
</span><del>-               {{{ data.author.avatar }}}
-               <div class="author-info">
-                               
-                       <span class="byline"><?php printf( __( 'Revision by %s' ),
-                               '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>
-                       <span class="time-ago">{{ data.timeAgo }}</span>
-                       <span class="date">({{ data.dateShort }})</span>
-               </div>
</del><ins>+                        <div class="author-card<# if ( data.autosave ) { #> autosave<# } #>">
+                               {{{ data.author.avatar }}}
+                               <div class="author-info">
+                               <# if ( data.autosave ) { #>
+                                       <span class="byline"><?php printf( __( 'Autosave by %s' ),
+                                               '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>
+                               <# } else if ( data.current ) { #>
+                                       <span class="byline"><?php printf( __( 'Current Revision by %s' ),
+                                               '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>
+                               <# } else { #>
+                                       <span class="byline"><?php printf( __( 'Revision by %s' ),
+                                               '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>
+                               <# } #>
+                                       <span class="time-ago">{{ data.timeAgo }}</span>
+                                       <span class="date">({{ data.dateShort }})</span>
+                               </div>
+                       </div>
</ins><span class="cx">   <# } #>
</span><span class="cx">  </div>
</span><span class="cx">  <div class="revisions-tooltip-arrow"><span></span></div>
</span><span class="lines">@@ -166,11 +175,19 @@
</span><span class="cx">          <div class="diff-title">
</span><span class="cx">                  <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
</span><span class="cx">          <# if ( 'undefined' !== typeof data.from ) { #>
</span><del>-                       <div class="author-card">
</del><ins>+                        <div class="author-card<# if ( data.from.attributes.autosave ) { #> autosave<# } #>">
</ins><span class="cx">                           {{{ data.from.attributes.author.avatar }}}
</span><span class="cx">                          <div class="author-info">
</span><ins>+                               <# if ( data.from.attributes.autosave ) { #>
+                                       <span class="byline"><?php printf( __( 'Autosave by %s' ),
+                                               '<span class="author-name">{{ data.from.attributes.author.name }}</span>' ); ?></span>
+                               <# } else if ( data.from.attributes.current ) { #>
+                                       <span class="byline"><?php printf( __( 'Current Revision by %s' ),
+                                               '<span class="author-name">{{ data.from.attributes.author.name }}</span>' ); ?></span>
+                               <# } else { #>
</ins><span class="cx">                                   <span class="byline"><?php printf( __( 'Revision by %s' ),
</span><span class="cx">                                          '<span class="author-name">{{ data.from.attributes.author.name }}</span>' ); ?></span>
</span><ins>+                               <# } #>
</ins><span class="cx">                                   <span class="time-ago">{{ data.from.attributes.timeAgo }}</span>
</span><span class="cx">                                  <span class="date">({{ data.from.attributes.dateShort }})</span>
</span><span class="cx">                          </div>
</span><span class="lines">@@ -183,20 +200,34 @@
</span><span class="cx">          <div class="diff-title">
</span><span class="cx">                  <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
</span><span class="cx">          <# if ( 'undefined' !== typeof data.to ) { #>
</span><del>-                       <div class="author-card">
</del><ins>+                        <div class="author-card<# if ( data.to.attributes.autosave ) { #> autosave<# } #>">
</ins><span class="cx">                           {{{ data.to.attributes.author.avatar }}}
</span><span class="cx">                          <div class="author-info">
</span><ins>+                               <# if ( data.to.attributes.autosave ) { #>
+                                       <span class="byline"><?php printf( __( 'Autosave by %s' ),
+                                               '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span>
+                               <# } else if ( data.to.attributes.current ) { #>
+                                       <span class="byline"><?php printf( __( 'Current Revision by %s' ),
+                                               '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span>
+                               <# } else { #>
</ins><span class="cx">                                   <span class="byline"><?php printf( __( 'Revision by %s' ),
</span><span class="cx">                                          '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span>
</span><ins>+                               <# } #>
</ins><span class="cx">                                   <span class="time-ago">{{ data.to.attributes.timeAgo }}</span>
</span><span class="cx">                                  <span class="date">({{ data.to.attributes.dateShort }})</span>
</span><span class="cx">                          </div>
</span><span class="cx">          <# } #>
</span><ins>+               <# if ( data.to.attributes.restoreUrl ) { #>
</ins><span class="cx">                   <input 
</span><span class="cx">                  <# if ( data.to.attributes.current ) { #>
</span><span class="cx">                          disabled="disabled"
</span><span class="cx">                  <# } #>
</span><del>-                       type="button" class="restore-revision button button-primary" data-restore-link="{{{ data.restoreLink }}}" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
</del><ins>+                        <# if ( data.to.attributes.autosave ) { #>
+                               type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
+                       <# } else { #>
+                               type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
+                       <# } #>
+               <# } #>
</ins><span class="cx">           </div>
</span><span class="cx">  </div>
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkwpincludesrevisionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/revision.php (24789 => 24790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/revision.php   2013-07-24 05:52:49 UTC (rev 24789)
+++ trunk/wp-includes/revision.php      2013-07-24 06:08:14 UTC (rev 24790)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">  * @return object|bool The autosaved data or false on failure or when no autosave exists.
</span><span class="cx">  */
</span><span class="cx"> function wp_get_post_autosave( $post_id, $user_id = 0 ) {
</span><del>-       $revisions = wp_get_post_revisions($post_id);
</del><ins>+        $revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
</ins><span class="cx"> 
</span><span class="cx">  foreach ( $revisions as $revision ) {
</span><span class="cx">          if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
</span><span class="lines">@@ -369,11 +369,15 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_get_post_revisions( $post_id = 0, $args = null ) {
</span><span class="cx">  $post = get_post( $post_id );
</span><del>-       if ( ! $post || empty( $post->ID ) || ! wp_revisions_enabled( $post ) )
</del><ins>+        if ( ! $post || empty( $post->ID ) )
</ins><span class="cx">           return array();
</span><span class="cx"> 
</span><del>-       $defaults = array( 'order' => 'DESC', 'orderby' => 'date' );
</del><ins>+        $defaults = array( 'order' => 'DESC', 'orderby' => 'date', 'check_enabled' => true );
</ins><span class="cx">   $args = wp_parse_args( $args, $defaults );
</span><ins>+
+       if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
+               return array();
+
</ins><span class="cx">   $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
</span><span class="cx"> 
</span><span class="cx">  if ( ! $revisions = get_children( $args ) )
</span></span></pre>
</div>
</div>

</body>
</html>