core: update vnode selection

pull/188/head
undefined 3 years ago
parent 7377bfadb0
commit 8ae067239c

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.32.34",
"version": "2.32.35",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",

@ -159,7 +159,7 @@ class DiscussionCreateHandler extends DiscussionHandler {
if (highlight) this.checkPerm(PERM.PERM_HIGHLIGHT_DISCUSSION);
if (pin) this.checkPerm(PERM.PERM_PIN_DISCUSSION);
const did = await discussion.add(
domainId, typeMapper[type], this.vnode.docId, this.user._id,
domainId, typeMapper[type], this.vnode.id, this.user._id,
title, content, this.request.ip, highlight, pin,
);
this.response.body = { did };

@ -12,7 +12,11 @@ class NotFoundHandler extends Handler {
throw new NotFoundError(this.request.path);
}
all() { }
get() { }
post() { }
head() { }
put() { }
delete() { }
}
export async function apply() {

@ -126,6 +126,7 @@ export class ProblemMainHandler extends ProblemHandler {
for (const pid of pids) {
// eslint-disable-next-line no-await-in-loop
const pdoc = await problem.get(domainId, pid);
if (!pdoc) continue;
if (!this.user.own(pdoc, PERM.PERM_EDIT_PROBLEM_SELF)) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
// eslint-disable-next-line no-await-in-loop
await problem.del(domainId, pid);

@ -696,7 +696,7 @@ async function handle(ctx, HandlerClass, checker) {
} else if (typeof h.post !== 'function') {
throw new MethodNotAllowedError(method);
}
} else if (typeof h[method] !== 'function' && typeof h.all !== 'function') {
} else if (typeof h[method] !== 'function') {
throw new MethodNotAllowedError(method);
}

Loading…
Cancel
Save