From 6915e640a2f73767b7481af87da1a119dd4ef77b Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Mon, 20 Nov 2017 16:26:19 +0200 Subject: [PATCH] Ensure tx listing --- src/components/ActivityFeed/ActivityFeed.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/ActivityFeed/ActivityFeed.js b/src/components/ActivityFeed/ActivityFeed.js index 96b0ad64..5dda9ae9 100644 --- a/src/components/ActivityFeed/ActivityFeed.js +++ b/src/components/ActivityFeed/ActivityFeed.js @@ -4,7 +4,7 @@ import { injectIntl, intlShape } from 'react-intl'; import classNames from 'classnames'; import { Avatar } from '../../components'; import { formatDate } from '../../util/dates'; -import { ensureTransaction, ensureUser } from '../../util/data'; +import { ensureTransaction, ensureUser, ensureListing } from '../../util/data'; import * as propTypes from '../../util/propTypes'; import css from './ActivityFeed.css'; @@ -143,9 +143,14 @@ export const ActivityFeedComponent = props => { : []; const currentCustomer = ensureUser(currentTransaction.customer); const currentProvider = ensureUser(currentTransaction.provider); + const currentListing = ensureListing(currentTransaction.listing); - const transitionsAvailable = - currentUser && currentUser.id && currentCustomer.id && currentProvider.id; + const transitionsAvailable = !!( + currentUser && + currentUser.id && + currentCustomer.id && + currentProvider.id + ); const isMessage = item => item && item.type === 'message'; @@ -166,7 +171,7 @@ export const ActivityFeedComponent = props => { currentUser={currentUser} customer={currentCustomer} provider={currentProvider} - listingTitle={currentTransaction.listing.attributes.title} + listingTitle={currentListing.attributes.title} intl={intl} /> );