From 0330824ef3a0ba073434403c58fc55b81ede6414 Mon Sep 17 00:00:00 2001 From: Sara Marcondes Date: Wed, 29 Jul 2020 08:08:02 -0700 Subject: [PATCH 1/2] Rename problematically named function --- .../manage-connection/site-ownership.jsx | 12 ++++++------ ...ster.js => is-jetpack-user-connection-owner.js} | 7 ++++--- ...ster.js => is-jetpack-user-connection-owner.js} | 14 +++++++------- 3 files changed, 17 insertions(+), 16 deletions(-) rename client/state/selectors/{is-jetpack-user-master.js => is-jetpack-user-connection-owner.js} (66%) rename client/state/selectors/test/{is-jetpack-user-master.js => is-jetpack-user-connection-owner.js} (57%) diff --git a/client/my-sites/site-settings/manage-connection/site-ownership.jsx b/client/my-sites/site-settings/manage-connection/site-ownership.jsx index 741a60600f628..67a708b585706 100644 --- a/client/my-sites/site-settings/manage-connection/site-ownership.jsx +++ b/client/my-sites/site-settings/manage-connection/site-ownership.jsx @@ -20,7 +20,7 @@ import FormSettingExplanation from 'components/forms/form-setting-explanation'; import Gravatar from 'components/gravatar'; import isJetpackSiteConnected from 'state/selectors/is-jetpack-site-connected'; import isJetpackSiteInDevelopmentMode from 'state/selectors/is-jetpack-site-in-development-mode'; -import isJetpackUserMaster from 'state/selectors/is-jetpack-user-master'; +import isJetpackUserConnectionOwner from 'state/selectors/is-jetpack-user-connection-owner'; import OwnershipInformation from './ownership-information'; import QueryJetpackConnection from 'components/data/query-jetpack-connection'; import QueryJetpackUserConnection from 'components/data/query-jetpack-user-connection'; @@ -156,7 +156,7 @@ class SiteOwnership extends Component { } renderConnectionDetails() { - const { siteIsConnected, siteIsInDevMode, translate, userIsMaster } = this.props; + const { siteIsConnected, siteIsInDevMode, translate, userIsConnectionOwner } = this.props; if ( siteIsConnected === false ) { return translate( 'The site is not connected.' ); @@ -174,14 +174,14 @@ class SiteOwnership extends Component { return ( - { userIsMaster !== null && ( + { userIsConnectionOwner !== null && ( - { userIsMaster + { userIsConnectionOwner ? translate( "You are the owner of this site's connection to WordPress.com." ) : translate( "Somebody else owns this site's connection to WordPress.com." ) } ) } - { userIsMaster && this.renderCurrentUserDropdown() } + { userIsConnectionOwner && this.renderCurrentUserDropdown() } ); } @@ -281,7 +281,7 @@ export default connect( siteIsConnected: isJetpackSiteConnected( state, siteId ), siteIsJetpack: isJetpackSite( state, siteId ), siteIsInDevMode: isJetpackSiteInDevelopmentMode( state, siteId ), - userIsMaster: isJetpackUserMaster( state, siteId ), + userIsConnectionOwner: isJetpackUserConnectionOwner( state, siteId ), }; }, { changeOwner, recordTracksEvent, transferPlanOwnership } diff --git a/client/state/selectors/is-jetpack-user-master.js b/client/state/selectors/is-jetpack-user-connection-owner.js similarity index 66% rename from client/state/selectors/is-jetpack-user-master.js rename to client/state/selectors/is-jetpack-user-connection-owner.js index 7660863bf00e1..c0dedefa9b1f3 100644 --- a/client/state/selectors/is-jetpack-user-master.js +++ b/client/state/selectors/is-jetpack-user-connection-owner.js @@ -10,13 +10,14 @@ import { get } from 'lodash'; import getJetpackUserConnection from 'state/selectors/get-jetpack-user-connection'; /** - * Returns true if the Jetpack site current user is the master user who owns the connection. False otherwise. + * Returns true if the Jetpack site current user is the user who owns the connection. False otherwise. * Returns null if the site is unknown, or there is no information yet. * * @param {object} state Global state tree * @param {number} siteId The ID of the site we're querying - * @returns {?boolean} Whether the current site user is the master user. + * @returns {?boolean} Whether the current site user is the connection owner. */ -export default function isJetpackUserMaster( state, siteId ) { +export default function isJetpackUserConnectionOwner( state, siteId ) { + // eslint-disable-next-line inclusive-language/use-inclusive-words return get( getJetpackUserConnection( state, siteId ), [ 'isMaster' ], null ); } diff --git a/client/state/selectors/test/is-jetpack-user-master.js b/client/state/selectors/test/is-jetpack-user-connection-owner.js similarity index 57% rename from client/state/selectors/test/is-jetpack-user-master.js rename to client/state/selectors/test/is-jetpack-user-connection-owner.js index f6bec70973f93..601db31c38651 100644 --- a/client/state/selectors/test/is-jetpack-user-master.js +++ b/client/state/selectors/test/is-jetpack-user-connection-owner.js @@ -6,11 +6,11 @@ import { expect } from 'chai'; /** * Internal dependencies */ -import isJetpackUserMaster from 'state/selectors/is-jetpack-user-master'; +import isJetpackUserConnectionOwner from 'state/selectors/is-jetpack-user-connection-owner'; import { dataItems } from './fixtures/jetpack-connection'; -describe( 'isJetpackUserMaster()', () => { - test( "should return true if the user is the master user of the site's connection", () => { +describe( 'isJetpackUserConnectionOwner()', () => { + test( "should return true if the user is owner of the site's connection", () => { const stateIn = { jetpack: { connection: { @@ -19,11 +19,11 @@ describe( 'isJetpackUserMaster()', () => { }, }, siteId = 12345678; - const output = isJetpackUserMaster( stateIn, siteId ); + const output = isJetpackUserConnectionOwner( stateIn, siteId ); expect( output ).to.be.true; } ); - test( "should return false if the user is not the master user of the site's connection", () => { + test( "should return false if the user is not the owner of the site's connection", () => { const stateIn = { jetpack: { connection: { @@ -32,7 +32,7 @@ describe( 'isJetpackUserMaster()', () => { }, }, siteId = 87654321; - const output = isJetpackUserMaster( stateIn, siteId ); + const output = isJetpackUserConnectionOwner( stateIn, siteId ); expect( output ).to.be.false; } ); @@ -45,7 +45,7 @@ describe( 'isJetpackUserMaster()', () => { }, }, siteId = 88888888; - const output = isJetpackUserMaster( stateIn, siteId ); + const output = isJetpackUserConnectionOwner( stateIn, siteId ); expect( output ).to.be.null; } ); } ); From 41f6b1cd55bc5b110f68e79b41eca4dcca5d4e42 Mon Sep 17 00:00:00 2001 From: Sara Marcondes Date: Wed, 29 Jul 2020 08:08:48 -0700 Subject: [PATCH 2/2] Remove problematic language from comments --- .../extensions/woocommerce/app/promotions/promotion-models.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/extensions/woocommerce/app/promotions/promotion-models.js b/client/extensions/woocommerce/app/promotions/promotion-models.js index 6a711da225f26..4a32375b447a9 100644 --- a/client/extensions/woocommerce/app/promotions/promotion-models.js +++ b/client/extensions/woocommerce/app/promotions/promotion-models.js @@ -361,7 +361,7 @@ const freeShippingModel = { }; /** - * Master list of models by promotion type. + * Primary list of models by promotion type. * * Note: The keys of this object correspond with promotion.type */ @@ -379,7 +379,7 @@ export default allModels; * * @param {object} promotion The promotion to validate. * @param {string} currency The currency to use for validations. - * @param { bool } showEmptyValidationErrors True if empty required fields should be errors. + * @param {boolean} showEmptyValidationErrors True if empty required fields should be errors. * @returns {object} Validation error strings keyed by their field names. */ export function validateAll( promotion, currency, showEmptyValidationErrors ) {