Skip to content

Commit adb4fad

Browse files
authored
Merge pull request Expensify#63985 from software-mansion-labs/@szymczak/fix-showing-expense-recipent-on-narrow-reports-page
Show expense recipent even when recipent is the same as submitter
2 parents e64f8b4 + bc796d1 commit adb4fad

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/components/SelectionList/Search/UserInfoAndActionButtonRow.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ function UserInfoAndActionButtonRow({
2424
const hasToRecipient = !!item?.to && !!item?.to?.accountID && !!item?.to?.displayName;
2525
const participantFromDisplayName = item?.from?.displayName ?? item?.from?.login ?? translate('common.hidden');
2626
const participantToDisplayName = item?.to?.displayName ?? item?.to?.login ?? translate('common.hidden');
27-
const shouldShowToRecipient =
28-
hasFromSender && hasToRecipient && !!item?.to?.accountID && item?.from?.accountID !== item?.to?.accountID && !!isCorrectSearchUserName(participantToDisplayName);
27+
const shouldShowToRecipient = hasFromSender && hasToRecipient && !!item?.to?.accountID && !!isCorrectSearchUserName(participantToDisplayName);
2928

3029
return (
3130
<View style={[styles.pt0, styles.flexRow, styles.alignItemsCenter, shouldShowUserInfo ? styles.justifyContentBetween : styles.justifyContentEnd, styles.gap2, styles.ph3]}>

tests/ui/ReportListItemHeaderTest.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ describe('ReportListItemHeader', () => {
138138
expect(screen.queryByTestId('ArrowRightLong Icon')).not.toBeOnTheScreen();
139139
});
140140

141-
it('should only display submitter if submitter and recipient are the same', async () => {
141+
it('should display submitter and receiver, even if submitter and recipient are the same', async () => {
142142
const reportItem = createReportListItem(CONST.REPORT.TYPE.IOU, 'john', 'john');
143143
renderReportListItemHeader(reportItem);
144144
await waitForBatchedUpdates();
145145

146-
expect(screen.getByText('John Doe')).toBeOnTheScreen();
147-
expect(screen.queryByTestId('ArrowRightLong Icon')).not.toBeOnTheScreen();
146+
expect(screen.getAllByText('John Doe')).toHaveLength(2);
147+
expect(screen.getByTestId('ArrowRightLong Icon')).toBeOnTheScreen();
148148
});
149149

150150
it('should not render anything if neither submitter nor recipient is present', async () => {
@@ -184,13 +184,13 @@ describe('ReportListItemHeader', () => {
184184
expect(screen.queryByTestId('ArrowRightLong Icon')).not.toBeOnTheScreen();
185185
});
186186

187-
it('should only display submitter if submitter and recipient are the same', async () => {
187+
it('should display submitter and receiver, even if submitter and recipient are the same', async () => {
188188
const reportItem = createReportListItem(CONST.REPORT.TYPE.EXPENSE, 'john', 'john');
189189
renderReportListItemHeader(reportItem);
190190
await waitForBatchedUpdates();
191191

192-
expect(screen.getByText('John Doe')).toBeOnTheScreen();
193-
expect(screen.queryByTestId('ArrowRightLong Icon')).not.toBeOnTheScreen();
192+
expect(screen.getAllByText('John Doe')).toHaveLength(2);
193+
expect(screen.getByTestId('ArrowRightLong Icon')).toBeOnTheScreen();
194194
});
195195

196196
it('should not render anything if no participants are present', async () => {

0 commit comments

Comments
 (0)