Make WordPress Core


Ignore:
Timestamp:
06/10/2020 07:29:06 PM (6 years ago)
Author:
whyisjake
Message:

Editor: Ensure latest comments can only be viewed from public posts.

This brings the changes from [47984] to the 5.1 branch.

Props: poena, xknown.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/tests/phpunit/tests/blocks/render.php

    r44261 r47987  
    264264    }
    265265
     266    public function test_render_latest_comments_on_password_protected_post() {
     267        $post_id      = self::factory()->post->create(
     268            array(
     269                'post_password' => 'password',
     270            )
     271        );
     272        $comment_text = wp_generate_password( 10, false );
     273        self::factory()->comment->create(
     274            array(
     275                'comment_post_ID' => $post_id,
     276                'comment_content' => $comment_text,
     277            )
     278        );
     279        $comments = do_blocks( '<!-- wp:latest-comments {"commentsToShow":1,"displayExcerpt":true} /-->' );
     280
     281        $this->assertNotContains( $comment_text, $comments );
     282    }
     283
    266284    /**
    267285     * @ticket 45109
Note: See TracChangeset for help on using the changeset viewer.