From 51b2c6579a4638ca528a144a17087a107f74904e Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Fri, 22 Sep 2023 00:04:55 +0530 Subject: [PATCH] search subscription using fname field too --- .../UserAndRoomAutoCompleteMultiple.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/meteor/client/components/UserAndRoomAutoCompleteMultiple/UserAndRoomAutoCompleteMultiple.tsx b/apps/meteor/client/components/UserAndRoomAutoCompleteMultiple/UserAndRoomAutoCompleteMultiple.tsx index 96d11cf44cb7..d3066a2c880e 100644 --- a/apps/meteor/client/components/UserAndRoomAutoCompleteMultiple/UserAndRoomAutoCompleteMultiple.tsx +++ b/apps/meteor/client/components/UserAndRoomAutoCompleteMultiple/UserAndRoomAutoCompleteMultiple.tsx @@ -18,7 +18,13 @@ const UserAndRoomAutoCompleteMultiple = ({ value, onChange, ...props }: UserAndR const debouncedFilter = useDebouncedValue(filter, 1000); const rooms = useUserSubscriptions( - useMemo(() => ({ open: { $ne: false }, lowerCaseName: new RegExp(escapeRegExp(debouncedFilter), 'i') }), [debouncedFilter]), + useMemo( + () => ({ + open: { $ne: false }, + $or: [{ lowerCaseName: new RegExp(escapeRegExp(debouncedFilter), 'i') }, { fname: new RegExp(escapeRegExp(debouncedFilter), 'i') }], + }), + [debouncedFilter], + ), ).filter((room) => { if (!user) { return;