diff --git a/assets/components/cards/render/CardRow.jsx b/assets/components/cards/render/CardRow.jsx index b2525f554..d5933842a 100644 --- a/assets/components/cards/render/CardRow.jsx +++ b/assets/components/cards/render/CardRow.jsx @@ -14,10 +14,15 @@ class CardRow extends React.Component { } } render() { - const {title, product, children, userProducts,userType} = this.props; + const {title, product, children, userProducts, userType, companyProducts} = this.props; let moreNews = this.props.moreNews; - if (userType !== 'administrator'){ - moreNews = userProducts.some((userProduct) => userProduct._id === product._id); + + if (userType !== 'administrator') { + const isProductInUserProducts = userProducts.some(userProduct => userProduct._id === product._id); + const isProductInCompanyProductsWithoutSeats = companyProducts.some( + companyProduct => companyProduct._id === product._id && !companyProduct.seats + ); + moreNews = isProductInUserProducts || isProductInCompanyProductsWithoutSeats; } return ( @@ -38,11 +43,13 @@ CardRow.propTypes = { user: PropTypes.object, userProducts: PropTypes.array, userType: PropTypes.string, + companyProducts: PropTypes.array, }; const mapStateToProps = (state) => ({ userProducts: state.userProducts, userType: state.userType, + companyProducts: state.companyProducts, }); CardRow.defaultProps = { diff --git a/assets/home/reducers.js b/assets/home/reducers.js index ae8dd7ef5..0a52851ca 100644 --- a/assets/home/reducers.js +++ b/assets/home/reducers.js @@ -33,6 +33,7 @@ export default function homeReducer(state=initialState, action) { products: action.data.products, user: action.data.user, userType: action.data.userType, + companyProducts: action.data.companyProducts, userProducts: action.data.userProducts, company: action.data.company, formats: action.data.formats || [], diff --git a/newsroom/wire/views.py b/newsroom/wire/views.py index ee8900773..0e3cf2a2e 100644 --- a/newsroom/wire/views.py +++ b/newsroom/wire/views.py @@ -144,6 +144,7 @@ def get_home_data(): "userProducts": user.get("products") if user else [], "userType": user.get("user_type"), "company": company_id, + "companyProducts": company.get("products") if company else [], "formats": [ { "format": f["format"],