From 8ca27a4480fd429759ad1fed156b22ee7782f5a0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 30 Nov 2018 00:13:13 +0900 Subject: [PATCH] Fix #3432 --- src/server/api/endpoints/users/search.ts | 78 ------------------------ 1 file changed, 78 deletions(-) diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index edc4d603c..b37c07003 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -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