Ticket #29294: 29294.2.patch
File 29294.2.patch, 2.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/post.php
229 229 $post_id = edit_post(); 230 230 231 231 // Session cookie flag that the post was saved 232 if ( isset( $_COOKIE['wp-saving-post-' . $post_id] ) ) 233 setcookie( 'wp-saving-post-' . $post_id, 'saved' ); 232 if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) { 233 setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS ); 234 } 234 235 235 236 redirect_post($post_id); // Send user on their way while we keep working 236 237 -
src/wp-includes/js/autosave.js
286 286 }); 287 287 } 288 288 289 wpCookies.set( 'wp-saving-post -' + post_id, 'check');289 wpCookies.set( 'wp-saving-post', post_id + '-check', 24 * 60 * 60 ); 290 290 }); 291 291 } 292 292 … … 309 309 function checkPost() { 310 310 var content, post_title, excerpt, $notice, 311 311 postData = getSavedPostData(), 312 cookie = wpCookies.get( 'wp-saving-post -' + post_id);312 cookie = wpCookies.get( 'wp-saving-post' ); 313 313 314 if ( ! postData ) { 314 if ( cookie === post_id + '-saved' ) { 315 wpCookies.remove( 'wp-saving-post' ); 316 // The post was saved properly, remove old data and bail 317 setData( false ); 315 318 return; 316 319 } 317 320 318 if ( cookie ) { 319 wpCookies.remove( 'wp-saving-post-' + post_id ); 320 321 if ( cookie === 'saved' ) { 322 // The post was saved properly, remove old data and bail 323 setData( false ); 324 return; 325 } 321 if ( ! postData ) { 322 return; 326 323 } 327 324 328 325 // There is a newer autosave. Don't show two "restore" notices at the same time. … … 334 331 post_title = $( '#title' ).val() || ''; 335 332 excerpt = $( '#excerpt' ).val() || ''; 336 333 337 // cookie == 'check' means the post was not saved properly, always show #local-storage-notice 338 if ( cookie !== 'check' && compare( content, postData.content ) && 339 compare( post_title, postData.post_title ) && compare( excerpt, postData.excerpt ) ) { 334 if ( compare( content, postData.content ) && compare( post_title, postData.post_title ) && 335 compare( excerpt, postData.excerpt ) ) { 340 336 341 337 return; 342 338 }