Skip to content

Commit

Permalink
Domains: Move user dependency to Email data component
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Dec 7, 2015
1 parent 70a408b commit 3ace0b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 1 addition & 3 deletions client/components/data/domain-management/email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const MyComponent = React.createClass( {
productsList={ productsList }
selectedDomainName={ selectedDomainName }
context={ context }
sites={ sites }
user={ user.get() } />
sites={ sites } />
);
}
} );
Expand All @@ -39,7 +38,6 @@ The component expects to receive all listed props:
* `productsList` - a collection of all the products users can have on WordPress.com
* `selectedDomainName` - the domain name currently selected
* `sites` - a list of user sites
* `user` - a current user object

The child component should receive processed props defined during the render:

Expand Down
13 changes: 7 additions & 6 deletions client/components/data/domain-management/email/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ var StoreConnection = require( 'components/data/store-connection' ),
GoogleAppsUsersStore = require( 'lib/domains/google-apps-users/store' ),
CartStore = require( 'lib/cart/store' ),
observe = require( 'lib/mixins/data-observe' ),
upgradesActions = require( 'lib/upgrades/actions' );
upgradesActions = require( 'lib/upgrades/actions' ),
userFactory = require( 'lib/user' );

const user = userFactory();

var stores = [
DomainsStore,
Expand All @@ -34,7 +37,7 @@ function getStateFromStores( props ) {
googleAppsUsers: GoogleAppsUsersStore.getByDomainName( props.selectedDomainName ),
selectedDomainName: props.selectedDomainName,
selectedSite: props.selectedSite,
user: props.user
user: user.get()
};
}

Expand All @@ -46,8 +49,7 @@ module.exports = React.createClass( {
context: React.PropTypes.object.isRequired,
productsList: React.PropTypes.object.isRequired,
selectedDomainName: React.PropTypes.string,
sites: React.PropTypes.object.isRequired,
user: React.PropTypes.object.isRequired
sites: React.PropTypes.object.isRequired
},

mixins: [ observe( 'productsList' ) ],
Expand Down Expand Up @@ -79,8 +81,7 @@ module.exports = React.createClass( {
products={ this.props.productsList.get() }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }
context={ this.props.context }
user={ this.props.user } />
context={ this.props.context } />
);
}
} );
6 changes: 1 addition & 5 deletions client/my-sites/upgrades/domain-management/controller.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ProductsList from 'lib/products-list';
import SiteRedirectData from 'components/data/domain-management/site-redirect';
import SitesList from 'lib/sites-list';
import TransferData from 'components/data/domain-management/transfer';
import User from 'lib/user';
import WhoisData from 'components/data/domain-management/whois';
import titleActions from 'lib/screen-title/actions';

Expand Down Expand Up @@ -147,8 +146,6 @@ module.exports = {
},

domainManagementEmail( context ) {
const user = new User();

setTitle(
i18n.translate( 'Domain Management › Email' ),
context
Expand All @@ -165,8 +162,7 @@ module.exports = {
productsList={ productsList }
selectedDomainName={ context.params.domain }
context={ context }
sites={ sites }
user={ user.get() } />
sites={ sites } />
);
},

Expand Down

0 comments on commit 3ace0b6

Please sign in to comment.