mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -07:00
Improve 賢さ
This commit is contained in:
parent
e26c77ab32
commit
8772f0e785
1 changed files with 25 additions and 1 deletions
|
@ -21,12 +21,36 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
||||||
let users = await User
|
let users = await User
|
||||||
.find({
|
.find({
|
||||||
host: null,
|
host: null,
|
||||||
usernameLower: new RegExp(escapeRegexp(query.toLowerCase()))
|
usernameLower: new RegExp('^' + escapeRegexp(query.toLowerCase()))
|
||||||
}, {
|
}, {
|
||||||
limit: limit,
|
limit: limit,
|
||||||
skip: offset
|
skip: offset
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (users.length < limit) {
|
||||||
|
const remoteUsers = await User
|
||||||
|
.find({
|
||||||
|
host: { $ne: null },
|
||||||
|
usernameLower: new RegExp('^' + escapeRegexp(query.toLowerCase()))
|
||||||
|
}, {
|
||||||
|
limit: limit - users.length
|
||||||
|
});
|
||||||
|
|
||||||
|
users = users.concat(remoteUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (users.length < limit) {
|
||||||
|
const remoteUsers = await User
|
||||||
|
.find({
|
||||||
|
host: null,
|
||||||
|
usernameLower: new RegExp(escapeRegexp(query.toLowerCase()))
|
||||||
|
}, {
|
||||||
|
limit: limit - users.length
|
||||||
|
});
|
||||||
|
|
||||||
|
users = users.concat(remoteUsers);
|
||||||
|
}
|
||||||
|
|
||||||
if (users.length < limit) {
|
if (users.length < limit) {
|
||||||
const remoteUsers = await User
|
const remoteUsers = await User
|
||||||
.find({
|
.find({
|
||||||
|
|
Loading…
Reference in a new issue