Skip to content

Commit

Permalink
Jetpack Connect: Remove problematic "blacklist"/"whitelist" language #…
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Jun 24, 2020
1 parent 74049ca commit 1f6f3e5
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 28 deletions.
16 changes: 8 additions & 8 deletions client/jetpack-connect/authorize.js
Expand Up @@ -48,7 +48,7 @@ import {
RETRY_AUTH,
RETRYING_AUTH,
SECRET_EXPIRED,
SITE_BLACKLISTED,
SITE_BLOCKED,
USER_IS_ALREADY_CONNECTED_TO_SITE,
XMLRPC_ERROR,
} from './connection-notice-types';
Expand All @@ -69,7 +69,7 @@ import {
hasExpiredSecretError as hasExpiredSecretErrorSelector,
hasXmlrpcError as hasXmlrpcErrorSelector,
isRemoteSiteOnSitesList,
isSiteBlacklistedError as isSiteBlacklistedSelector,
isSiteBlockedError as isSiteBlockedSelector,
} from 'state/jetpack-connect/selectors';
import getPartnerIdFromQuery from 'state/selectors/get-partner-id-from-query';
import getPartnerSlugFromQuery from 'state/selectors/get-partner-slug-from-query';
Expand Down Expand Up @@ -100,7 +100,7 @@ export class JetpackAuthorize extends Component {
isAlreadyOnSitesList: PropTypes.bool,
isFetchingAuthorizationSite: PropTypes.bool,
isFetchingSites: PropTypes.bool,
isSiteBlacklisted: PropTypes.bool,
isSiteBlocked: PropTypes.bool,
recordTracksEvent: PropTypes.func.isRequired,
retryAuth: PropTypes.func.isRequired,
translate: PropTypes.func.isRequired,
Expand Down Expand Up @@ -164,7 +164,7 @@ export class JetpackAuthorize extends Component {
! this.retryingAuth &&
! nextProps.hasXmlrpcError &&
! nextProps.hasExpiredSecretError &&
! nextProps.isSiteBlacklisted &&
! nextProps.isSiteBlocked &&
site
) {
// Expired secret errors, and XMLRPC errors will be resolved in `handleResolve`.
Expand Down Expand Up @@ -519,10 +519,10 @@ export class JetpackAuthorize extends Component {
</Fragment>
);
}
if ( this.props.isSiteBlacklisted ) {
if ( this.props.isSiteBlocked ) {
return (
<JetpackConnectNotices
noticeType={ SITE_BLACKLISTED }
noticeType={ SITE_BLOCKED }
onTerminalError={ redirectToMobileApp }
/>
);
Expand Down Expand Up @@ -719,7 +719,7 @@ export class JetpackAuthorize extends Component {
renderStateAction() {
const { authorizeSuccess } = this.props.authorizationData;

if ( this.props.isSiteBlacklisted ) {
if ( this.props.isSiteBlocked ) {
return null;
}

Expand Down Expand Up @@ -807,7 +807,7 @@ const connectComponent = connect(
isFetchingAuthorizationSite: isRequestingSite( state, authQuery.clientId ),
isFetchingSites: isRequestingSites( state ),
isMobileAppFlow,
isSiteBlacklisted: isSiteBlacklistedSelector( state ),
isSiteBlocked: isSiteBlockedSelector( state ),
isVip: isVipSite( state, authQuery.clientId ),
mobileAppRedirect,
partnerID: getPartnerIdFromQuery( state ),
Expand Down
2 changes: 1 addition & 1 deletion client/jetpack-connect/connection-notice-types.js
Expand Up @@ -26,7 +26,7 @@ export const INVALID_PERMISSIONS = 'invalidPermissions';
export const RETRY_AUTH = 'retryAuth';
export const RETRYING_AUTH = 'retryingAuth';
export const SECRET_EXPIRED = 'secretExpired';
export const SITE_BLACKLISTED = 'siteBlacklisted';
export const SITE_BLOCKED = 'siteBlocked';
export const UNKNOWN_REMOTE_INSTALL_ERROR = 'unknownRemoteInstallError';
export const USER_IS_ALREADY_CONNECTED_TO_SITE = 'userIsAlreadyConnectedToSite';
export const WORDPRESS_DOT_COM = 'wordpress.com';
Expand Down
2 changes: 1 addition & 1 deletion client/jetpack-connect/constants.js
Expand Up @@ -7,4 +7,4 @@ export const REMOTE_PATH_AUTH =
'/wp-admin/admin.php?page=jetpack&connect_url_redirect=true&jetpack_connect_login_redirect=true';
export const REMOTE_PATH_INSTALL =
'/wp-admin/plugin-install.php?tab=plugin-information&plugin=jetpack';
export const MOBILE_APP_REDIRECT_URL_WHITELIST = [ /^wordpress:\/\// ];
export const ALLOWED_MOBILE_APP_REDIRECT_URL_LIST = [ /^wordpress:\/\// ];
4 changes: 2 additions & 2 deletions client/jetpack-connect/controller.js
Expand Up @@ -27,7 +27,7 @@ import { getCurrentUserId } from 'state/current-user/selectors';
import { getLocaleFromPath, removeLocaleFromPath, getPathParts } from 'lib/i18n-utils';
import switchLocale from 'lib/i18n-utils/switch-locale';
import { hideMasterbar, showMasterbar, hideSidebar } from 'state/ui/actions';
import { JPC_PATH_PLANS, MOBILE_APP_REDIRECT_URL_WHITELIST } from './constants';
import { JPC_PATH_PLANS, ALLOWED_MOBILE_APP_REDIRECT_URL_LIST } from './constants';
import { login } from 'lib/paths';
import { parseAuthorizationQuery } from './utils';
import { persistMobileRedirect, retrieveMobileRedirect, storePlan } from './persistence-utils';
Expand Down Expand Up @@ -116,7 +116,7 @@ export function persistMobileAppFlow( context, next ) {
const { query } = context;
if ( config.isEnabled( 'jetpack/connect/mobile-app-flow' ) ) {
if (
some( MOBILE_APP_REDIRECT_URL_WHITELIST, ( pattern ) =>
some( ALLOWED_MOBILE_APP_REDIRECT_URL_LIST, ( pattern ) =>
pattern.test( query.mobile_redirect )
)
) {
Expand Down
6 changes: 3 additions & 3 deletions client/jetpack-connect/jetpack-connect-notices.jsx
Expand Up @@ -28,7 +28,7 @@ import {
RETRY_AUTH,
RETRYING_AUTH,
SECRET_EXPIRED,
SITE_BLACKLISTED,
SITE_BLOCKED,
USER_IS_ALREADY_CONNECTED_TO_SITE,
WORDPRESS_DOT_COM,
XMLRPC_ERROR,
Expand Down Expand Up @@ -62,7 +62,7 @@ export class JetpackConnectNotices extends Component {
RETRY_AUTH,
RETRYING_AUTH,
SECRET_EXPIRED,
SITE_BLACKLISTED,
SITE_BLOCKED,
USER_IS_ALREADY_CONNECTED_TO_SITE,
WORDPRESS_DOT_COM,
XMLRPC_ERROR,
Expand Down Expand Up @@ -90,7 +90,7 @@ export class JetpackConnectNotices extends Component {
case NOT_EXISTS:
return noticeValues;

case SITE_BLACKLISTED:
case SITE_BLOCKED:
noticeValues.text = translate(
"This site can't be connected to WordPress.com because it violates our {{a}}Terms of Service{{/a}}.",
{
Expand Down
2 changes: 1 addition & 1 deletion client/state/jetpack-connect/selectors/index.js
Expand Up @@ -7,4 +7,4 @@ export { getUserAlreadyConnected } from 'state/jetpack-connect/selectors/get-use
export { hasExpiredSecretError } from 'state/jetpack-connect/selectors/has-expired-secret-error';
export { hasXmlrpcError } from 'state/jetpack-connect/selectors/has-xmlrpc-error';
export { isRemoteSiteOnSitesList } from 'state/jetpack-connect/selectors/is-remote-site-on-sites-list';
export { isSiteBlacklistedError } from 'state/jetpack-connect/selectors/is-site-blacklisted-error';
export { isSiteBlockedError } from 'state/jetpack-connect/selectors/is-site-blocked-error';
Expand Up @@ -11,12 +11,12 @@ import { getAuthorizationData } from 'state/jetpack-connect/selectors/get-author
import 'state/jetpack-connect/init';

/**
* Returns true if the authorization error indicates that site has been blacklisted.
* Returns true if the authorization error indicates that site has been blocked.
*
* @param {object} state Global state tree
* @returns {boolean} True if there's a blacklisted site error, false otherwise
* @returns {boolean} True if there's a blocked site error, false otherwise
*/
export const isSiteBlacklistedError = function ( state ) {
export const isSiteBlockedError = function ( state ) {
const authorizeData = getAuthorizationData( state );

return get( authorizeData, [ 'authorizeError', 'error' ] ) === 'site_blacklisted';
Expand Down
16 changes: 8 additions & 8 deletions client/state/jetpack-connect/test/selectors.js
Expand Up @@ -11,7 +11,7 @@ import {
hasExpiredSecretError,
hasXmlrpcError,
isRemoteSiteOnSitesList,
isSiteBlacklistedError,
isSiteBlockedError,
} from '../selectors';

describe( 'selectors', () => {
Expand Down Expand Up @@ -371,9 +371,9 @@ describe( 'selectors', () => {
} );
} );

describe( '#isSiteBlacklistedError', () => {
describe( '#isSiteBlockedError', () => {
test( 'should be false when there is an empty state', () => {
const hasError = isSiteBlacklistedError( { jetpackConnect: {} } );
const hasError = isSiteBlockedError( { jetpackConnect: {} } );
expect( hasError ).toBe( false );
} );

Expand All @@ -385,7 +385,7 @@ describe( 'selectors', () => {
},
},
};
const hasError = isSiteBlacklistedError( stateHasNoError );
const hasError = isSiteBlockedError( stateHasNoError );
expect( hasError ).toBe( false );
} );

Expand All @@ -399,12 +399,12 @@ describe( 'selectors', () => {
},
},
};
const hasError = isSiteBlacklistedError( stateHasOtherError );
const hasError = isSiteBlockedError( stateHasOtherError );
expect( hasError ).toBe( false );
} );

test( 'should be true if site has been blacklisted', () => {
const stateHasBeenBlacklistedError = {
test( 'should be true if site has been blocked', () => {
const stateHasBeenBlockedError = {
jetpackConnect: {
jetpackConnectAuthorize: {
authorizeError: {
Expand All @@ -413,7 +413,7 @@ describe( 'selectors', () => {
},
},
};
const hasError = isSiteBlacklistedError( stateHasBeenBlacklistedError );
const hasError = isSiteBlockedError( stateHasBeenBlockedError );
expect( hasError ).toBe( true );
} );
} );
Expand Down
3 changes: 2 additions & 1 deletion client/state/jetpack/settings/utils.js
Expand Up @@ -22,10 +22,11 @@ export const normalizeSettings = ( settings ) => {
case 'jetpack_testimonial_posts_per_page':
case 'jetpack_portfolio_posts_per_page':
break;
case 'jetpack_protect_global_whitelist':
case 'jetpack_protect_global_whitelist': {
const whitelist = get( settings[ key ], [ 'local' ], [] );
memo[ key ] = whitelist.join( '\n' );
break;
}
case 'infinite-scroll':
break;
case 'infinite_scroll':
Expand Down

0 comments on commit 1f6f3e5

Please sign in to comment.