From 3111f56c8d886d8f47a2c6184fc0efc1bc47f1aa Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Thu, 16 May 2024 14:22:29 +0200 Subject: [PATCH] Make voter name filter easier to read Co-authored-by: lubej --- src/app/utils/vote.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/utils/vote.ts b/src/app/utils/vote.ts index bb935375f0..7ed042dcbe 100644 --- a/src/app/utils/vote.ts +++ b/src/app/utils/vote.ts @@ -13,5 +13,9 @@ const voteFilters: Record = { export const getFilterForVoteType = (voteType: VoteType): VoteFilter => voteFilters[voteType] -export const getFilterForVoterNameFragment = (fragment: string | undefined) => - fragment ? (vote: ExtendedVote) => hasTextMatch(vote.validator?.media?.name, [fragment]) : () => true +export const getFilterForVoterNameFragment = (fragment: string | undefined) => { + if (!fragment) { + return () => true + } + return (vote: ExtendedVote) => hasTextMatch(vote.validator?.media?.name, [fragment]) +}