mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-18 03:52:54 +00:00
use or clause for display name and username search (#12820)
* use or clause for display name and username search * update styling * More style fix * update comment and regex
This commit is contained in:
parent
3ce182d0dc
commit
f077e40c4c
1 changed files with 5 additions and 2 deletions
|
|
@ -322,9 +322,12 @@ function _getMembersForItem (type) {
|
|||
}
|
||||
|
||||
if (req.query.search) {
|
||||
// Creates a RegExp expression when querying for profile.name
|
||||
// Creates a RegExp expression when querying for profile.name and auth.local.username
|
||||
const escapedSearch = escapeRegExp(req.query.search);
|
||||
query['profile.name'] = { $regex: new RegExp(escapedSearch, 'i') };
|
||||
query.$or = [
|
||||
{ 'profile.name': { $regex: new RegExp(escapedSearch, 'i') } },
|
||||
{ 'auth.local.username': { $regex: new RegExp(req.query.search, 'i') } },
|
||||
];
|
||||
}
|
||||
} else if (type === 'group-invites') {
|
||||
if (group.type === 'guild') { // eslint-disable-line no-lonely-if
|
||||
|
|
|
|||
Loading…
Reference in a new issue