This commit is contained in:
syuilo 2019-03-15 13:51:23 +09:00
parent 5a87763193
commit dfabdef60f
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,7 @@ User.createIndex('createdAt');
User.createIndex('updatedAt');
User.createIndex('followersCount');
User.createIndex('tags');
User.createIndex('isSuspended');
User.createIndex('username');
User.createIndex('usernameLower');
User.createIndex('host');

View File

@ -70,7 +70,8 @@ export default define(meta, async (ps, me) => {
users = await User
.find({
host: null,
usernameLower: new RegExp('^' + escapeRegexp(ps.query.replace('@', '').toLowerCase()))
usernameLower: new RegExp('^' + escapeRegexp(ps.query.replace('@', '').toLowerCase())),
isSuspended: false
}, {
limit: ps.limit,
skip: ps.offset
@ -80,7 +81,8 @@ export default define(meta, async (ps, me) => {
const otherUsers = await User
.find({
host: { $ne: null },
usernameLower: new RegExp('^' + escapeRegexp(ps.query.replace('@', '').toLowerCase()))
usernameLower: new RegExp('^' + escapeRegexp(ps.query.replace('@', '').toLowerCase())),
isSuspended: false
}, {
limit: ps.limit - users.length
});