Fix #3432
This commit is contained in:
parent
77d2d84e05
commit
8ca27a4480
|
@ -70,84 +70,6 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
|||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < ps.limit) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: null,
|
||||
usernameLower: new RegExp(escapeRegexp(ps.query.replace('@', '').toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < ps.limit && !ps.localOnly) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: { $ne: null },
|
||||
usernameLower: new RegExp(escapeRegexp(ps.query.replace('@', '').toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
}
|
||||
|
||||
if (users.length < ps.limit) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: null,
|
||||
name: new RegExp('^' + escapeRegexp(ps.query.toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < ps.limit && !ps.localOnly) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: { $ne: null },
|
||||
name: new RegExp('^' + escapeRegexp(ps.query.toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < ps.limit) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: null,
|
||||
name: new RegExp(escapeRegexp(ps.query.toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < ps.limit && !ps.localOnly) {
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: { $ne: null },
|
||||
name: new RegExp(escapeRegexp(ps.query.toLowerCase()))
|
||||
}, {
|
||||
limit: ps.limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
// Serialize
|
||||
|
|
Loading…
Reference in New Issue