Skip to content

Commit 5476698

Browse files
do not use regex on email and phone fields search
1 parent 1e5b28f commit 5476698

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

apps/meteor/server/models/raw/LivechatContacts.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ export class LivechatContactsRaw extends BaseRaw<ILivechatContact> implements IL
110110
): FindPaginated<FindCursor<ILivechatContact>> {
111111
const { searchText, unknown = false, email, phone } = search;
112112
const searchRegex = escapeRegExp(searchText || '');
113-
const emailRegex = escapeRegExp(email || searchText || '');
114-
const phoneRegex = escapeRegExp(phone || searchText || '');
115113
const match: Filter<ILivechatContact & RootFilterOperators<ILivechatContact>> = {
116114
...(searchText && {
117115
$or: [
@@ -120,8 +118,8 @@ export class LivechatContactsRaw extends BaseRaw<ILivechatContact> implements IL
120118
{ 'phones.phoneNumber': { $regex: searchRegex, $options: 'i' } },
121119
],
122120
}),
123-
...(email && { 'emails.address': { $regex: emailRegex, $options: 'i' } }),
124-
...(phone && { 'phones.phoneNumber': { $regex: phoneRegex, $options: 'i' } }),
121+
...(email && { 'emails.address': email }),
122+
...(phone && { 'phones.phoneNumber': phone }),
125123
unknown,
126124
};
127125

0 commit comments

Comments
 (0)