mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复training nav支持定义插入位置
This commit is contained in:
1 parent
47ceddea9e
commit
46630065aa
6 files changed
+16
-7
No files matched your search
@@ -9,3 +9,5 @@ message.markAsRead
|
|||||||
评测队列优先级系统
|
评测队列优先级系统
|
||||||
讨论浏览数量显示
|
讨论浏览数量显示
|
||||||
解离mail模块
|
解离mail模块
|
||||||
|
@param @get @post @arg
|
||||||
|
extend problem settings
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.14",
|
"version": "2.13.15",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class DomainRoleHandler extends ManageHandler {
|
|||||||
const rdict: Dictionary<any> = {};
|
const rdict: Dictionary<any> = {};
|
||||||
for (const r of roles) rdict[r._id] = r.perm;
|
for (const r of roles) rdict[r._id] = r.perm;
|
||||||
if (rdict[role]) throw new RoleAlreadyExistError(role);
|
if (rdict[role]) throw new RoleAlreadyExistError(role);
|
||||||
await domain.addRole(domainId, role, rdict.default.perm);
|
await domain.addRole(domainId, role, rdict.default);
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
|
|
||||||
udoc: User;
|
udoc: User;
|
||||||
|
|
||||||
@param('pid', Types.String, null, parsePid)
|
@param('pid', Types.String, true, null, parsePid)
|
||||||
async _prepare(domainId: string, pid: number | string) {
|
async _prepare(domainId: string, pid: number | string) {
|
||||||
this.response.template = 'problem_detail.html';
|
this.response.template = 'problem_detail.html';
|
||||||
this.pdoc = await problem.get(domainId, pid, this.user._id);
|
this.pdoc = await problem.get(domainId, pid, this.user._id);
|
||||||
@@ -418,6 +418,7 @@ export class ProblemEditHandler extends ProblemManageHandler {
|
|||||||
@param('content', Types.String, isContent)
|
@param('content', Types.String, isContent)
|
||||||
async post(domainId: string, title: string, content: string) {
|
async post(domainId: string, title: string, content: string) {
|
||||||
const $update: Partial<Pdoc> = { title, content };
|
const $update: Partial<Pdoc> = { title, content };
|
||||||
|
console.log(this.request.body);
|
||||||
if (this.request.body.pid) $update.pid = checkPid(this.request.body.pid);
|
if (this.request.body.pid) $update.pid = checkPid(this.request.body.pid);
|
||||||
const pdoc = await problem.get(domainId, this.request.params.pid);
|
const pdoc = await problem.get(domainId, this.request.params.pid);
|
||||||
await problem.edit(domainId, pdoc.docId, $update);
|
await problem.edit(domainId, pdoc.docId, $update);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class TrainingDetailHandler extends Handler {
|
|||||||
async get(domainId: string, tid: ObjectID) {
|
async get(domainId: string, tid: ObjectID) {
|
||||||
const tdoc = await training.get(domainId, tid);
|
const tdoc = await training.get(domainId, tid);
|
||||||
await bus.serial('training/get', tdoc, this);
|
await bus.serial('training/get', tdoc, this);
|
||||||
const pids = training.getPids(tdoc);
|
const pids = training.getPids(tdoc.dag);
|
||||||
const [owner, pdict] = await Promise.all([
|
const [owner, pdict] = await Promise.all([
|
||||||
user.getById(domainId, tdoc.owner),
|
user.getById(domainId, tdoc.owner),
|
||||||
problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)),
|
problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)),
|
||||||
|
|||||||
@@ -37,9 +37,15 @@ export const Nav = (
|
|||||||
name: string, args: Dictionary<any> = {}, prefix: string,
|
name: string, args: Dictionary<any> = {}, prefix: string,
|
||||||
...permPrivChecker: Array<number | bigint | Function>
|
...permPrivChecker: Array<number | bigint | Function>
|
||||||
) => {
|
) => {
|
||||||
global.Hydro.ui.nodes.nav.push({
|
if (name.startsWith('@@')) {
|
||||||
name, args: args || {}, prefix, checker: buildChecker(...permPrivChecker),
|
global.Hydro.ui.nodes.nav.splice(+name.split('@@')[1], 0, {
|
||||||
});
|
name: name.split('@@')[2], args: args || {}, prefix, checker: buildChecker(...permPrivChecker),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
global.Hydro.ui.nodes.nav.push({
|
||||||
|
name, args: args || {}, prefix, checker: buildChecker(...permPrivChecker),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ProblemAdd = (
|
export const ProblemAdd = (
|
||||||
|
|||||||
Reference in new issue
Block a user