Skip to content

Commit

Permalink
Use last sent messages batch to generate pno form subscriber list
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 30, 2024
1 parent 9c95ad9 commit 0d86c8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ context('Side Window > Logbook Prior Notification Form > Sent Message List', ()
cy.get('address').eq(1).contains('[email protected]')
cy.get('address').eq(1).contains('+33987654321')

cy.get('address').eq(2).contains('Unité 5 (DDTM 40)')
cy.get('address').eq(2).contains('[email protected]')
cy.get('address').eq(2).contains('+33000000000')
// The last sent message doesn't include this unit contact details,
// they should not be displayed since they likely were unsubscribed in the meantime.
cy.get('address').contains('Unité 5 (DDTM 40)').should('not.exist')

cy.getDataCy('SentMessageList-historyItem')
.eq(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ type SentMessageListProps = Readonly<{
export function SentMessageList({ detail }: SentMessageListProps) {
const { data: sentMessages, isError } = useGetPriorNotificationSentNessagesQuery(detail.reportId)

const subscribers = sentMessages ? getSubscribersFromSentMessages(sentMessages) : undefined
const sentMessagesBatches = sentMessages ? getSentMessagesBatches(sentMessages) : undefined
const lastSentMessagesBatch = sentMessagesBatches ? sentMessagesBatches[sentMessagesBatches.length - 1] : undefined
const subscribers = lastSentMessagesBatch ? getSubscribersFromSentMessages(lastSentMessagesBatch.messages) : undefined

return (
<>
Expand Down

0 comments on commit 0d86c8b

Please sign in to comment.