Ticket #29294: 29294.patch
File 29294.patch, 1.9 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.