Skip to content

Commit

Permalink
Revert "Store: Remove a few unnecessary review config checks" (Automa…
Browse files Browse the repository at this point in the history
…ttic#23370)

* Revert "Webpack: remove HardSourceWebpackPlugin (Automattic#23342)"

This reverts commit d3c950e.

* Revert "Store: Remove a few unnecessary review config checks (Automattic#23354)"

This reverts commit dbff1c4.
  • Loading branch information
justinshreve authored Mar 16, 2018
1 parent d3c950e commit cd71150
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 11 additions & 5 deletions client/extensions/woocommerce/app/dashboard/manage-orders-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import config from 'config';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import classNames from 'classnames';
Expand Down Expand Up @@ -77,8 +78,14 @@ class ManageOrdersView extends Component {
if ( ! ordersLoaded ) {
this.props.fetchOrders( siteId );
}
// TODO This check can be removed when we launch reviews.
if ( config.isEnabled( 'woocommerce/extension-reviews' ) ) {
this.props.fetchReviews( siteId, { status: 'pending' } );
}
};

this.props.fetchReviews( siteId, { status: 'pending' } );
shouldShowPendingReviews = () => {
return config.isEnabled( 'woocommerce/extension-reviews' ) && this.props.pendingReviews;
};

possiblyRenderProcessOrdersWidget = () => {
Expand All @@ -91,7 +98,7 @@ class ManageOrdersView extends Component {
count: orders.length,
} );
const classes = classNames( 'dashboard__process-orders-container', {
'has-reviews': this.props.pendingReviews,
'has-reviews': this.shouldShowPendingReviews(),
} );
return (
<DashboardWidgetRow className={ classes }>
Expand All @@ -115,12 +122,11 @@ class ManageOrdersView extends Component {
};

possiblyRenderReviewsWidget = () => {
const { site, pendingReviews, translate } = this.props;

if ( ! pendingReviews ) {
if ( ! this.shouldShowPendingReviews() ) {
return null;
}

const { site, pendingReviews, translate } = this.props;
const countText = translate( '%d pending review', '%d pending reviews', {
args: [ pendingReviews ],
count: pendingReviews,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import React, { Component } from 'react';
import config from 'config';
import i18n from 'i18n-calypso';
import PropTypes from 'prop-types';
import { trim, isNumber } from 'lodash';
Expand Down Expand Up @@ -116,7 +117,7 @@ export default class ProductFormDetailsCard extends Component {

let productReviewsWidget = null;

if ( isNumber( product.id ) ) {
if ( isNumber( product.id ) && config.isEnabled( 'woocommerce/extension-reviews' ) ) {
productReviewsWidget = <ProductReviewsWidget product={ product } />;
}

Expand Down
5 changes: 4 additions & 1 deletion client/extensions/woocommerce/store-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ class StoreSidebar extends Component {
this.props.fetchSetupChoices( siteId );
this.props.fetchOrders( siteId );

this.props.fetchReviews( siteId, { status: 'pending' } );
// TODO This check can be removed when we launch reviews.
if ( config.isEnabled( 'woocommerce/extension-reviews' ) ) {
this.props.fetchReviews( siteId, { status: 'pending' } );
}

if ( ! productsLoaded ) {
this.props.fetchProducts( siteId, { page: 1 } );
Expand Down

0 comments on commit cd71150

Please sign in to comment.