Skip to content

Commit

Permalink
Merge pull request Expensify#44253 from callstack-internal/fix/preven…
Browse files Browse the repository at this point in the history
…t-displaying-email-twice-on-expense

fix: prevent displaying email twice in search when it exists
  • Loading branch information
srikarparsi authored Jun 24, 2024
2 parents 0b4812d + 20cba0d commit dc7e22f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ function filterOptions(options: Options, searchInputValue: string, config?: Filt

let userToInvite = null;
if (canInviteUser) {
if (recentReports.length === 0) {
if (recentReports.length === 0 && personalDetails.length === 0) {
userToInvite = getUserToInviteOption({
searchValue,
betas,
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/OptionsListUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,15 @@ describe('OptionsListUtils', () => {

expect(filteredOptions.recentReports.length).toBe(2);
});

it('should not return any user to invite if email exists on the personal details list', () => {
const searchText = 'natasharomanoff@expensify.com';
const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]);

const filteredOptions = OptionsListUtils.filterOptions(options, searchText);
expect(filteredOptions.personalDetails.length).toBe(1);
expect(filteredOptions.userToInvite).toBe(null);
});
});

describe('canCreateOptimisticPersonalDetailOption', () => {
Expand Down

0 comments on commit dc7e22f

Please sign in to comment.