From 1a7151dd3d282a7e7cae3a8814f3ff0e29fdbeac Mon Sep 17 00:00:00 2001 From: mertmit Date: Wed, 20 Dec 2023 10:46:12 +0300 Subject: [PATCH] fix: user field condition issue Signed-off-by: mertmit --- packages/nocodb/src/db/conditionV2.ts | 31 ++++++++------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index 73291b9759..e5e682668e 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -459,30 +459,17 @@ const parseConditionV2 = async ( const filterVal = filter.value.toLowerCase(); if (filterVal.startsWith('%') && filterVal.endsWith('%')) { - return ( - user.display_name - .toLowerCase() - .includes(filterVal.substring(1, filterVal.length - 1)) || - user.email - .toLowerCase() - .includes(filterVal.substring(1, filterVal.length - 1)) - ); + return (user.display_name || user.email) + .toLowerCase() + .includes(filterVal.substring(1, filterVal.length - 1)); } else if (filterVal.startsWith('%')) { - return ( - user.display_name - .toLowerCase() - .endsWith(filterVal.substring(1)) || - user.email.toLowerCase().endsWith(filterVal.substring(1)) - ); + return (user.display_name || user.email) + .toLowerCase() + .endsWith(filterVal.substring(1)); } else if (filterVal.endsWith('%')) { - return ( - user.display_name - .toLowerCase() - .startsWith(filterVal.substring(0, filterVal.length - 1)) || - user.email - .toLowerCase() - .startsWith(filterVal.substring(0, filterVal.length - 1)) - ); + return (user.display_name || user.email) + .toLowerCase() + .startsWith(filterVal.substring(0, filterVal.length - 1)); } return (user.display_name || user.email)