mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 05:43:07 +02:00
Fix bug
This commit is contained in:
parent
29f074267c
commit
49bc00102b
1 changed files with 8 additions and 6 deletions
|
@ -28,7 +28,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||
});
|
||||
|
||||
if (users.length < limit) {
|
||||
const remoteUsers = await User
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
host: { $ne: null },
|
||||
usernameLower: new RegExp('^' + escapeRegexp(query.toLowerCase()))
|
||||
|
@ -36,31 +36,33 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||
limit: limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(remoteUsers);
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < limit) {
|
||||
const remoteUsers = await User
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: null,
|
||||
usernameLower: new RegExp(escapeRegexp(query.toLowerCase()))
|
||||
}, {
|
||||
limit: limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(remoteUsers);
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
if (users.length < limit) {
|
||||
const remoteUsers = await User
|
||||
const otherUsers = await User
|
||||
.find({
|
||||
_id: { $nin: users.map(u => u._id) },
|
||||
host: { $ne: null },
|
||||
usernameLower: new RegExp(escapeRegexp(query.toLowerCase()))
|
||||
}, {
|
||||
limit: limit - users.length
|
||||
});
|
||||
|
||||
users = users.concat(remoteUsers);
|
||||
users = users.concat(otherUsers);
|
||||
}
|
||||
|
||||
// Serialize
|
||||
|
|
Loading…
Reference in a new issue