From 1896448ba9713d8e3872fee1e5d8b26c9435bb27 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Mon, 18 Dec 2017 15:26:25 +0200 Subject: [PATCH] Handle banned author display name --- src/containers/ListingPage/ListingPage.js | 8 +++++--- src/translations/en.json | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/containers/ListingPage/ListingPage.js b/src/containers/ListingPage/ListingPage.js index 9fceae55..3e5e636b 100644 --- a/src/containers/ListingPage/ListingPage.js +++ b/src/containers/ListingPage/ListingPage.js @@ -12,7 +12,7 @@ import { types } from '../../util/sdkLoader'; import { createSlug } from '../../util/urlHelpers'; import { formatMoney } from '../../util/currency'; import { createResourceLocatorString, findRouteByRouteName } from '../../util/routes'; -import { ensureListing, ensureUser, parseAddress } from '../../util/data'; +import { ensureListing, ensureUser, parseAddress, userDisplayName } from '../../util/data'; import { getListingsById } from '../../ducks/marketplaceData.duck'; import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck'; import { @@ -281,8 +281,10 @@ export class ListingPageComponent extends Component { const currentAuthor = authorAvailable ? currentListing.author : null; const ensuredAuthor = ensureUser(currentAuthor); - // TODO: use helper to handle banned - const authorDisplayName = ensuredAuthor.attributes.profile.displayName; + const bannedUserDisplayName = intl.formatMessage({ + id: 'ListingPage.bannedUserDisplayName', + }); + const authorDisplayName = userDisplayName(ensuredAuthor, bannedUserDisplayName); // TODO location address is currently serialized inside address field (API will change later) // Content is something like { locationAddress: 'Street, Province, Country', building: 'A 42' }; diff --git a/src/translations/en.json b/src/translations/en.json index ab8adac4..9dda8721 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -226,6 +226,7 @@ "ListingCard.perNight": "per night", "ListingCard.unsupportedPrice": "({currency})", "ListingCard.unsupportedPriceTitle": "Unsupported currency ({currency})", + "ListingPage.bannedUserDisplayName": "Banned user", "ListingPage.bookingHelp": "Start by choosing your dates.", "ListingPage.bookingHelpClosedListing": "Sorry, this listing has been closed.", "ListingPage.bookingTitle": "Book {title}",