diff --git a/src/components/AuthorInfo/AuthorInfo.js b/src/components/AuthorInfo/AuthorInfo.js index 21ae8b66..7a0ab6c8 100644 --- a/src/components/AuthorInfo/AuthorInfo.js +++ b/src/components/AuthorInfo/AuthorInfo.js @@ -3,25 +3,23 @@ import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { Avatar } from '../../components'; import * as propTypes from '../../util/propTypes'; +import { ensureUser } from '../../util/data'; import css from './AuthorInfo.css'; const AuthorInfo = props => { const { className, author } = props; const classes = classNames(css.root, className); - const currentAuthor = { id: null, type: 'user', attributes: {}, ...author }; - - const authorName = currentAuthor.attributes.profile - ? `${currentAuthor.attributes.profile.firstName} ${currentAuthor.attributes.profile.lastName}` - : ''; + const currentAuthor = ensureUser(author); + const { firstName, lastName } = currentAuthor.attributes.profile; return (
- +
- +
diff --git a/src/translations/en.json b/src/translations/en.json index 2901038b..151c7c6b 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -7,7 +7,7 @@ "AuthenticationPage.signupFailedEmailAlreadyTaken": "An account already exists with this email address. Try logging in instead.", "AuthenticationPage.signupLinkText": "Sign up", "AuthenticationPage.signupPageTitle": "Sign up", - "AuthorInfo.host": "Hosted by {authorName}", + "AuthorInfo.host": "Hosted by {firstName} {lastName}", "BookingDatesForm.bookingEndTitle": "End date", "BookingDatesForm.bookingStartTitle": "Start date", "BookingDatesForm.placeholder": "mm/dd/yyyy",