General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.

“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48121 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2020-06-22 17:24:34 +00:00
parent 9e3b322f8f
commit e26394bb2d
60 changed files with 423 additions and 281 deletions

View File

@@ -4,7 +4,7 @@
* @group comment
*/
class Tests_Comment_CheckComment extends WP_UnitTestCase {
public function test_should_return_true_when_comment_whitelist_is_disabled() {
public function test_should_return_true_when_comment_previously_approved_is_disabled() {
$author = 'BobtheBuilder';
$author_email = 'bob@example.com';
$author_url = 'http://example.com';
@@ -13,12 +13,12 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
$user_agent = '';
$comment_type = '';
update_option( 'comment_whitelist', 0 );
update_option( 'comment_previously_approved', 0 );
$results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
$this->assertTrue( $results );
}
public function test_should_return_false_when_comment_whitelist_is_enabled_and_author_does_not_have_approved_comment() {
public function test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment() {
$author = 'BobtheBuilder';
$author_email = 'bob@example.com';
$author_url = 'http://example.com';
@@ -27,13 +27,13 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
$user_agent = '';
$comment_type = '';
update_option( 'comment_whitelist', 1 );
update_option( 'comment_previously_approved', 1 );
$results = check_comment( $author, $author_email, $author_url, $comment, $author_ip, $user_agent, $comment_type );
$this->assertFalse( $results );
}
public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() {
public function test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment() {
$post_id = self::factory()->post->create();
$prev_args = array(
'comment_post_ID' => $post_id,
@@ -44,7 +44,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
);
$prev_comment_id = self::factory()->comment->create( $prev_args );
update_option( 'comment_whitelist', 1 );
update_option( 'comment_previously_approved', 1 );
$author = 'BobtheBuilder';
$author_email = 'bob@example.com';
@@ -69,7 +69,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
}
public function test_should_return_false_when_content_matches_moderation_key() {
update_option( 'comment_whitelist', 0 );
update_option( 'comment_previously_approved', 0 );
$author = 'WendytheBuilder';
$author_email = 'wendy@example.com';
@@ -85,7 +85,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
}
public function test_should_return_true_when_content_does_not_match_moderation_keys() {
update_option( 'comment_whitelist', 0 );
update_option( 'comment_previously_approved', 0 );
$author = 'WendytheBuilder';
$author_email = 'wendy@example.com';
@@ -101,7 +101,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
}
public function test_should_return_false_when_link_count_exceeds_comment_max_length_setting() {
update_option( 'comment_whitelist', 0 );
update_option( 'comment_previously_approved', 0 );
$author = 'BobtheBuilder';
$author_email = 'bob@example.com';
@@ -117,7 +117,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
}
public function test_should_return_true_when_link_count_does_not_exceed_comment_max_length_setting() {
update_option( 'comment_whitelist', 0 );
update_option( 'comment_previously_approved', 0 );
$author = 'BobtheBuilder';
$author_email = 'bob@example.com';
@@ -135,7 +135,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
/**
* @ticket 28603
*/
public function test_should_return_true_when_comment_whitelist_is_enabled_and_user_has_previously_approved_comments_with_different_email() {
public function test_should_return_true_when_comment_previously_approved_is_enabled_and_user_has_previously_approved_comments_with_different_email() {
$subscriber_id = $this->factory()->user->create(
array(
'role' => 'subscriber',
@@ -158,7 +158,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
wp_update_user( $subscriber_user );
update_option( 'comment_whitelist', 1 );
update_option( 'comment_previously_approved', 1 );
$results = check_comment( 'foo', 'newsub@example.com', 'http://example.com', 'This is a comment.', '66.155.40.249', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0', 'comment', 4 );
$this->assertTrue( $results );
@@ -167,7 +167,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
/**
* @ticket 28603
*/
public function test_should_return_false_when_comment_whitelist_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() {
public function test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() {
$subscriber_id = $this->factory()->user->create(
array(
'role' => 'subscriber',
@@ -180,7 +180,7 @@ class Tests_Comment_CheckComment extends WP_UnitTestCase {
wp_update_user( $subscriber_user );
update_option( 'comment_whitelist', 1 );
update_option( 'comment_previously_approved', 1 );
$results = check_comment( 'bar', 'zag@example.com', 'http://example.com', 'This is my first comment.', '66.155.40.249', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0', 'comment', 4 );
$this->assertFalse( $results );