Changeset 54130
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
r51962 r54130 221 221 $user_id = get_current_user_id(); 222 222 223 if ( ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) && $post->post_author == $user_id ) { 223 // We need to check post lock to ensure the original author didn't leave their browser tab open. 224 if ( ! function_exists( 'wp_check_post_lock' ) ) { 225 require_once ABSPATH . 'wp-admin/includes/post.php'; 226 } 227 228 $post_lock = wp_check_post_lock( $post->ID ); 229 $is_draft = 'draft' === $post->post_status || 'auto-draft' === $post->post_status; 230 231 if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock ) { 224 232 // Draft posts for the same author: autosaving updates the post and does not create a revision. 225 233 // Convert the post object to an array and add slashes, wp_update_post() expects escaped array. -
trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php
r54058 r54130 608 608 $this->assertNotEquals( 'garbage', get_post( self::$draft_page_id )->comment_status ); 609 609 } 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 610 677 }
Note: See TracChangeset
for help on using the changeset viewer.