Skip to content

Commit

Permalink
Fix a bug when we were accessing non-existent interaction.contact
Browse files Browse the repository at this point in the history
property
  • Loading branch information
peterhudec committed Dec 6, 2024
1 parent a421537 commit fe49d8c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
1 change: 1 addition & 0 deletions src/apps/events/attendees/controllers/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async function renderAttendees(req, res, next) {
children: [{ value: sortby }],
})

// TODO: Can we remove this?
res.breadcrumb(name).render('events/attendees/views/list', {
incompleteEvent,
attendees: attendeesCollection,
Expand Down
72 changes: 35 additions & 37 deletions src/client/modules/Events/EventDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import State from '../../../components/State'

import { VerticalTabNav } from '../../../components/TabNav'
import InteractionsV3 from '../../../components/Resource/InteractionsV3'
import { formatMediumDate } from '../../../utils/date'
import { formatLongDate } from '../../../utils/date'

const StyledSummaryTable = styled(SummaryTable)({
marginTop: 0,
Expand Down Expand Up @@ -47,42 +47,40 @@ const Attendees = ({ eventId }) => (
>
{(page) => (
<ul>
{page.map((interaction) => (
<CollectionItem
headingText={interaction.contact.name}
headingUrl={`/contacts/${interaction.contact.id}`}
metadata={[
{
label: 'Company',
value: (
<Link href={`/companies/${interaction.companies[0].id}`}>
{interaction.companies[0].name}
</Link>
),
},
...(interaction.contact.job_title
? [
{
label: 'Job title',
value: interaction.contact.job_title,
},
]
: []),
{
label: 'Date attended',
value: formatMediumDate(interaction.date),
},
{
label: 'Service delivery',
value: (
<Link href={`/companies/${interaction.service.id}`}>
{interaction.service.name}
</Link>
),
},
]}
/>
))}
{page.map(
({ contacts: [contact], companies: [company], date, service }) => (
<CollectionItem
headingText={contact?.name || 'Not available'}
headingUrl={contact && `/contacts/${contact?.id}`}
metadata={[
{
label: 'Company',
value: (
<Link href={`/companies/${company?.id}`}>
{company?.name}
</Link>
),
},
{
label: 'Job title',
value: contact?.job_title || 'Not available',
},
{
label: 'Date attended',
value: formatLongDate(date),
},
{
label: 'Service delivery',
value: (
<Link href={`/companies/${service.id}`}>
{service.name}
</Link>
),
},
]}
/>
)
)}
</ul>
)}
</InteractionsV3.Paginated>
Expand Down

0 comments on commit fe49d8c

Please sign in to comment.