Pass in raw author instead of ensured to avoid validation errors

This commit is contained in:
Kimmo Puputti 2017-12-14 15:38:05 +02:00
parent 4124fb6d0e
commit 0cb35faae7

View file

@ -276,8 +276,9 @@ export class ListingPageComponent extends Component {
const isOwnListing =
userAndListingAuthorAvailable && currentListing.author.id.uuid === currentUser.id.uuid;
const currentAuthor = ensureUser(authorAvailable ? currentListing.author : {});
const currentAuthorDisplayName = currentAuthor.attributes.profile.displayName;
const currentAuthor = authorAvailable ? currentListing.author : null;
const ensuredAuthor = ensureUser(currentAuthor);
const authorDisplayName = ensuredAuthor.attributes.profile.displayName;
// TODO location address is currently serialized inside address field (API will change later)
// Content is something like { locationAddress: 'Street, Province, Country', building: 'A 42' };
@ -374,7 +375,7 @@ export class ListingPageComponent extends Component {
params={params}
to={{ hash: '#host' }}
>
{currentAuthorDisplayName}
{authorDisplayName}
</NamedLink>
);
@ -393,7 +394,7 @@ export class ListingPageComponent extends Component {
<Page
title={schemaTitle}
scrollingDisabled={scrollingDisabled}
author={currentAuthorDisplayName}
author={authorDisplayName}
contentType="website"
description={description}
facebookImages={facebookImages}
@ -527,7 +528,7 @@ export class ListingPageComponent extends Component {
<span className={css.authorName}>
<FormattedMessage
id="ListingPage.hostedBy"
values={{ name: currentAuthorDisplayName }}
values={{ name: authorDisplayName }}
/>
</span>
</div>