Changeset 23981
- Timestamp:
- 04/13/2013 12:41:15 AM (11 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r23975 r23981 1064 1064 1065 1065 if ( ! empty( $_POST['autosave'] ) ) { 1066 // Drafts and auto-drafts are just overwritten by autosave for the same user1067 if ( get_current_user_id() == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) {1066 if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) { 1067 // Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked 1068 1068 $id = edit_post(); 1069 } else { // Non drafts are not overwritten. The autosave is stored in a special post revision for each user. 1069 } else { 1070 // Non drafts or other users drafts are not overwritten. The autosave is stored in a special post revision for each user. 1070 1071 $revision_id = wp_create_post_autosave( $post->ID ); 1071 1072 if ( is_wp_error($revision_id) ) … … 1075 1076 } 1076 1077 1077 if ( is_wp_error($id) ) { 1078 // is_wp_error($id) overwrites $data in WP_Ajax_Response but no point in doing wp_create_nonce('update-post_' . $id) below 1079 // todo: Needs review. The errors generated in WP_Ajax_Response and parsed with wpAjax.parseAjaxResponse() haven't been used for many years. 1080 $data = $id; 1081 $id = 0; 1082 } else { 1078 // When is_wp_error($id), $id overwrites $data in WP_Ajax_Response 1079 // todo: Needs review. The errors generated in WP_Ajax_Response and parsed with wpAjax.parseAjaxResponse() haven't been used for years. 1080 if ( ! is_wp_error($id) ) { 1083 1081 /* translators: draft saved date format, see http://php.net/date */ 1084 1082 $draft_saved_date_format = __('g:i:s a'); … … 1099 1097 $supplemental['replace-closedpostboxesnonce'] = wp_create_nonce('closedpostboxes'); 1100 1098 $supplemental['replace-_ajax_linking_nonce'] = wp_create_nonce( 'internal-linking' ); 1101 if ( $id ) 1102 $supplemental['replace-_wpnonce'] = wp_create_nonce('update-post_' . $id); 1099 $supplemental['replace-_wpnonce'] = wp_create_nonce( 'update-post_' . $post->ID ); 1103 1100 } 1104 1101 … … 1106 1103 'what' => 'autosave', 1107 1104 'id' => $id, 1108 'data' => $ id ? $data : '',1105 'data' => $data, 1109 1106 'supplemental' => $supplemental 1110 1107 ) ); … … 2130 2127 2131 2128 // make sure the right revision is the most recent 2132 if ( $compare_two_mode && $right_revision-> post_date < $left_revision->post_date) {2129 if ( $compare_two_mode && $right_revision->ID < $left_revision->ID ) { 2133 2130 $temp = $left_revision; 2134 2131 $left_revision = $right_revision; -
trunk/wp-admin/js/post.js
r23843 r23981 277 277 wrap = $('#notification-dialog-wrap'); 278 278 279 if ( ! wrap.is(':visible') ) { 280 autosave(); 279 if ( wrap.length && ! wrap.is(':visible') ) { 280 if ( typeof autosave == 'function' ) 281 autosave(); 281 282 282 283 if ( received.lock_error.avatar_src ) {
Note: See TracChangeset
for help on using the changeset viewer.