mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix user_search handler
This commit is contained in:
1 parent
f3153993f7
commit
ff6777a8c0
4 files changed
+14
-29
No files matched your search
@@ -237,12 +237,16 @@ class UserSearchHandler extends Handler {
|
||||
@param('q', Types.String)
|
||||
@param('exectMatch', Types.Boolean)
|
||||
async get(domainId: string, q: string, exactMatch = false) {
|
||||
let udoc = await user.getById(domainId, parseInt(q, 10));
|
||||
let udoc = await user.getById(domainId, +q);
|
||||
const udocs: User[] = udoc ? [udoc] : [];
|
||||
udoc = await user.getByUname(domainId, q);
|
||||
if (udoc) udocs.push(udoc);
|
||||
udoc = await user.getByEmail(domainId, q);
|
||||
if (udoc) udocs.push(udoc);
|
||||
if (!udocs.length) {
|
||||
udoc = await user.getByUname(domainId, q);
|
||||
if (udoc) udocs.push(udoc);
|
||||
else {
|
||||
udoc = await user.getByEmail(domainId, q);
|
||||
if (udoc) udocs.push(udoc);
|
||||
}
|
||||
}
|
||||
if (!exactMatch) udocs.push(...await user.getPrefixList(domainId, q, 20));
|
||||
for (const i in udocs) {
|
||||
udocs[i].avatarUrl = avatar(udocs[i].avatar);
|
||||
|
||||
Reference in new issue
Block a user