diff --git a/src/components/Reviews/Reviews.example.js b/src/components/Reviews/Reviews.example.js index aedd5610..f57eadd1 100644 --- a/src/components/Reviews/Reviews.example.js +++ b/src/components/Reviews/Reviews.example.js @@ -26,7 +26,20 @@ export const WithBannedUser = { createReview( 'review_1', { rating: 1 }, - { author: createUser('author_1', { banned: true, profile: null }) } + { author: createUser('author_1', { banned: true, deleted: false, profile: null }) } + ), + ], + }, +}; + +export const WithDeletedUser = { + component: Reviews, + props: { + reviews: [ + createReview( + 'review_1', + { rating: 2 }, + { author: createUser('author_1', { banned: false, deleted: true, profile: null }) } ), ], }, diff --git a/src/components/Reviews/Reviews.js b/src/components/Reviews/Reviews.js index 8e8e40b9..9233b6b7 100644 --- a/src/components/Reviews/Reviews.js +++ b/src/components/Reviews/Reviews.js @@ -2,17 +2,11 @@ import React from 'react'; import { injectIntl, intlShape } from 'react-intl'; import { arrayOf, string } from 'prop-types'; import classNames from 'classnames'; -import { Avatar, ReviewRating } from '../../components'; +import { Avatar, ReviewRating, UserDisplayName } from '../../components'; import { propTypes } from '../../util/types'; import css from './Reviews.css'; -const authorDisplayName = (review, intl) => { - return review.author.attributes.banned - ? intl.formatMessage({ id: 'Reviews.bannedUserDisplayName' }) - : review.author.attributes.profile.displayName; -}; - const Review = props => { const { review, intl } = props; @@ -30,7 +24,7 @@ const Review = props => { />

{review.attributes.content}

- {authorDisplayName(review, intl)} + {dateString}