Skip to content

Commit

Permalink
Domains: Remove problematic "blacklist"/"whitelist" language #43395
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Jun 24, 2020
1 parent 74049ca commit 4cf766e
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions client/components/domains/register-domain-step/utility.js
Expand Up @@ -57,10 +57,10 @@ export function markFeaturedSuggestions(
return output;
}

export function filterOutDomainsWithTlds( suggestions, blacklistTlds ) {
export function filterOutDomainsWithTlds( suggestions, disallowedTlds ) {
return suggestions.filter( ( suggestion ) => {
const tld = suggestion.domain_name.split( '.' ).pop();
return blacklistTlds.indexOf( tld ) === -1;
return disallowedTlds.indexOf( tld ) === -1;
} );
}

Expand Down
2 changes: 1 addition & 1 deletion client/lib/domains/constants.js
Expand Up @@ -25,7 +25,7 @@ export const domainAvailability = {
AVAILABLE: 'available',
AVAILABLE_PREMIUM: 'available_premium',
AVAILABILITY_CHECK_ERROR: 'availability_check_error',
BLACKLISTED: 'blacklisted_domain',
DISALLOWED: 'blacklisted_domain',
DOMAIN_SUGGESTIONS_THROTTLED: 'domain_suggestions_throttled',
DOTBLOG_SUBDOMAIN: 'dotblog_subdomain',
EMPTY_QUERY: 'empty_query',
Expand Down
2 changes: 1 addition & 1 deletion client/lib/domains/get-tld.js
Expand Up @@ -8,7 +8,7 @@ import wpcomMultiLevelTlds from './tlds/wpcom-multi-level-tlds.json';
* Parse the tld from a given domain name, semi-naively. The function
* first parses against a list of tlds that have been sold on WP.com
* and falls back to a simplistic "everything after the last dot" approach
* if the whitelist failed. This is ultimately not comprehensive as that
* if the list of explicitly allowed tlds failed. This is ultimately not comprehensive as that
* is a poor base assumption (lots of second level tlds, etc). However,
* for our purposes, the approach should be "good enough" for a long time.
*
Expand Down
4 changes: 2 additions & 2 deletions client/lib/domains/registration/availability-messages.js
Expand Up @@ -233,7 +233,7 @@ function getAvailabilityNotice( domain, error, errorData ) {
);
break;

case domainAvailability.BLACKLISTED:
case domainAvailability.DISALLOWED:
if ( domain && domain.toLowerCase().indexOf( 'wordpress' ) > -1 ) {
message = translate(
'Due to {{a1}}trademark policy{{/a1}}, ' +
Expand All @@ -254,7 +254,7 @@ function getAvailabilityNotice( domain, error, errorData ) {
);
} else {
message = translate(
'Domain cannot be mapped to a WordPress.com blog because of blacklisted term.'
'Domain cannot be mapped to a WordPress.com blog because of disallowed term.'
);
}
break;
Expand Down
Expand Up @@ -25,7 +25,7 @@ describe( 'getAvailabilityNotice()', () => {

test( 'Should return default message when domain is not a string', () => {
expect(
getAvailabilityNotice( null, domainAvailability.BLACKLISTED, {
getAvailabilityNotice( null, domainAvailability.DISALLOWED, {
site: 1,
maintenanceEndTime: 2,
} )
Expand Down
4 changes: 2 additions & 2 deletions client/my-sites/current-site/domain-warnings.jsx
Expand Up @@ -18,7 +18,7 @@ import QuerySiteDomains from 'components/data/query-site-domains';
import isUnlaunchedSite from 'state/selectors/is-unlaunched-site';
import isSiteEligibleForFullSiteEditing from 'state/selectors/is-site-eligible-for-full-site-editing';

const ruleWhiteList = [
const allowedRules = [
'unverifiedDomainsCanManage',
'unverifiedDomainsCannotManage',
'expiredDomainsCanManage',
Expand Down Expand Up @@ -53,7 +53,7 @@ const CurrentSiteDomainWarnings = ( {
isCompact
selectedSite={ selectedSite }
domains={ domains }
ruleWhiteList={ ruleWhiteList }
allowedRules={ allowedRules }
isSiteEligibleForFSE={ isSiteEligibleForFSE }
siteIsUnlaunched={ siteIsUnlaunched }
/>
Expand Down
6 changes: 3 additions & 3 deletions client/my-sites/domains/components/domain-warnings/index.jsx
Expand Up @@ -60,7 +60,7 @@ const newTransfersWrongNSWarning = 'new-transfer-wrong-ns';
export class DomainWarnings extends React.PureComponent {
static propTypes = {
domains: PropTypes.array,
ruleWhiteList: PropTypes.array,
allowedRules: PropTypes.array,
domain: PropTypes.object,
isCompact: PropTypes.bool,
siteIsUnlaunched: PropTypes.bool,
Expand All @@ -69,7 +69,7 @@ export class DomainWarnings extends React.PureComponent {

static defaultProps = {
isCompact: false,
ruleWhiteList: [
allowedRules: [
'expiredDomainsCanManage',
'expiringDomainsCanManage',
'unverifiedDomainsCanManage',
Expand Down Expand Up @@ -125,7 +125,7 @@ export class DomainWarnings extends React.PureComponent {
this.newTransfersWrongNS,
this.pendingConsent,
];
const validRules = this.props.ruleWhiteList.map( ( ruleName ) => this[ ruleName ] );
const validRules = this.props.allowedRules.map( ( ruleName ) => this[ ruleName ] );
return intersection( allRules, validRules );
}

Expand Down
Expand Up @@ -417,11 +417,11 @@ describe( 'index', () => {
} );

describe( 'Ruleset filtering', () => {
test( 'should only process whitelisted renderers', () => {
test( 'should only process allowed renderers', () => {
const props = {
translate: identity,
domain: { name: 'example.com' },
ruleWhiteList: [],
allowedRules: [],
selectedSite: {},
moment,
};
Expand All @@ -435,7 +435,7 @@ describe( 'index', () => {
const props = {
translate: identity,
domain: { name: 'example.com' },
ruleWhiteList: [ 'getDomains' ],
allowedRules: [ 'getDomains' ],
selectedSite: {},
moment,
};
Expand Down
Expand Up @@ -356,7 +356,7 @@ class RegisteredDomainType extends React.Component {
domain={ this.props.domain }
position="registered-domain"
selectedSite={ this.props.selectedSite }
ruleWhiteList={ [ 'newTransfersWrongNS', 'pendingConsent' ] }
allowedRules={ [ 'newTransfersWrongNS', 'pendingConsent' ] }
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/domains/domain-management/list/index.jsx
Expand Up @@ -86,7 +86,7 @@ export class List extends React.Component {
domains={ this.props.domains }
position="domain-list"
selectedSite={ this.props.selectedSite }
ruleWhiteList={ [
allowedRules={ [
'newDomainsWithPrimary',
'newDomains',
'unverifiedDomainsCanManage',
Expand Down
Expand Up @@ -134,7 +134,7 @@ class NameServers extends React.Component {
domain={ domain }
position="domain-name-servers"
selectedSite={ this.props.selectedSite }
ruleWhiteList={ [ 'pendingTransfer' ] }
allowedRules={ [ 'pendingTransfer' ] }
/>
{ this.warning() }
{ this.planUpsellForNonPrimaryDomain( domain ) }
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/plans/current-plan/index.jsx
Expand Up @@ -153,7 +153,7 @@ class CurrentPlan extends Component {
domains={ domains }
position="current-plan"
selectedSite={ selectedSite }
ruleWhiteList={ [
allowedRules={ [
'newDomainsWithPrimary',
'newDomains',
'unverifiedDomainsCanManage',
Expand Down
1 change: 1 addition & 0 deletions packages/domain-picker/src/domain-picker/index.tsx
Expand Up @@ -154,6 +154,7 @@ const DomainPicker: FunctionComponent< Props > = ( {
<Icon icon={ search } />
</div>
<TextControl
// Unable to remove this instance due to it being a HotJar term: https://github.com/Automattic/wp-calypso/pull/43348#discussion_r442015229
data-hj-whitelist
hideLabelFromVision
label={ label }
Expand Down

0 comments on commit 4cf766e

Please sign in to comment.