Skip to content

Commit 22d1ef8

Browse files
MelvinBotmkhutornyi
andcommitted
Reuse getKey in applyChanges to remove duplicate identifier logic
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
1 parent 5b43009 commit 22d1ef8

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

src/components/Search/SearchFiltersParticipantsSelector.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,7 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
182182
};
183183

184184
const applyChanges = () => {
185-
let selectedIdentifiers: string[];
186-
187-
if (shouldAllowNameOnlyOptions) {
188-
selectedIdentifiers = selectedOptions
189-
.map((option) => {
190-
// Real users → accountID; name-only attendees → displayName or login.
191-
if (option.accountID && option.accountID !== CONST.DEFAULT_NUMBER_ID && personalDetails?.[option.accountID]) {
192-
return option.accountID.toString();
193-
}
194-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- need || to handle empty string
195-
return option.displayName || option.login;
196-
})
197-
.filter(Boolean) as string[];
198-
} else {
199-
selectedIdentifiers = selectedOptions.map((option) => (option.accountID ? option.accountID.toString() : undefined)).filter(Boolean) as string[];
200-
}
201-
185+
const selectedIdentifiers = selectedOptions.map(getKey).filter(Boolean) as string[];
202186
onFiltersUpdate(selectedIdentifiers);
203187
Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute());
204188
};

0 commit comments

Comments
 (0)