mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
update
This commit is contained in:
1 parent
8389519249
commit
a5886ecb99
37 files changed
+940
-162
No files matched your search
@@ -118,7 +118,7 @@ class ContestBoardcastHandler extends ContestHandler {
|
||||
const tdoc = await contest.get(domainId, tid);
|
||||
if (tdoc.owner !== this.user._id) throw new PermissionError('Boardcast Message');
|
||||
const tsdocs = await contest.getMultiStatus(domainId, { docId: tid }).toArray();
|
||||
const uids = Array.from(new Set(tsdocs.map((tsdoc) => tsdoc.uid)));
|
||||
const uids: number[] = Array.from(new Set(tsdocs.map((tsdoc) => tsdoc.uid)));
|
||||
await Promise.all(
|
||||
uids.map((uid) => message.send(this.user._id, uid, content, message.FLAG_ALERT)),
|
||||
);
|
||||
@@ -343,7 +343,7 @@ class ContestCodeHandler extends ContestHandler {
|
||||
},
|
||||
}).toArray();
|
||||
for (const rdoc of rdocs) {
|
||||
zip.addFile(`${rnames[rdoc._id]}.${rdoc.lang}`, rdoc.code);
|
||||
zip.addFile(`${rnames[rdoc._id.toHexString()]}.${rdoc.lang}`, Buffer.from(rdoc.code));
|
||||
}
|
||||
await this.binary(zip.toBuffer(), `${tdoc.title}.zip`);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ class HomeworkCodeHandler extends HomeworkHandler {
|
||||
},
|
||||
}).toArray();
|
||||
for (const rdoc of rdocs) {
|
||||
zip.addFile(`${rnames[rdoc._id]}.${rdoc.lang}`, rdoc.code);
|
||||
zip.addFile(`${rnames[rdoc._id.toHexString()]}.${rdoc.lang}`, Buffer.from(rdoc.code));
|
||||
}
|
||||
await this.binary(zip.toBuffer(), `${tdoc.title}.zip`);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { isEmail, isPassword, isUname } from '../lib/validator';
|
||||
import { sendMail } from '../lib/mail';
|
||||
import * as misc from '../lib/misc';
|
||||
import paginate from '../lib/paginate';
|
||||
import { User } from '../interface';
|
||||
|
||||
class UserLoginHandler extends Handler {
|
||||
async get() {
|
||||
@@ -201,12 +202,12 @@ class UserSearchHandler extends Handler {
|
||||
@param('exectMatch', Types.Boolean)
|
||||
async get(domainId: string, q: string, exactMatch = false) {
|
||||
let udoc = await user.getById(domainId, parseInt(q, 10));
|
||||
const udocs = udoc ? [udoc] : [];
|
||||
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 (!exactMatch) udocs.push(...await user.getPrefixList(q, 20));
|
||||
if (!exactMatch) udocs.push(...await user.getPrefixList(domainId, q, 20));
|
||||
for (const i in udocs) {
|
||||
udocs[i].gravatar = misc.gravatar(udocs[i].gravatar || '');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user