This commit is contained in:
undefined committed 2025-11-07 21:01:30 +08:00
1 parent cc413531f1
commit 643416373f
3 files changed
+4 -38

No files matched your search

+2
View File
@@ -254,6 +254,7 @@ export class ProblemMainHandler extends Handler {
for (const pid of pids) {
// eslint-disable-next-line no-await-in-loop
const pdoc = await problem.get(domainId, pid);
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
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.edit(domainId, pid, { hidden: true });
@@ -266,6 +267,7 @@ export class ProblemMainHandler extends Handler {
for (const pid of pids) {
// eslint-disable-next-line no-await-in-loop
const pdoc = await problem.get(domainId, pid);
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
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.edit(domainId, pid, { hidden: false });
+2 -2
View File
@@ -7,7 +7,7 @@ import { Dictionary } from 'lodash';
import moment from 'moment-timezone';
import Schema from 'schemastery';
import { LangConfig, parseLang } from '@hydrooj/common';
import { findFileSync, randomstring, retry } from '@hydrooj/utils';
import { findFileSync, randomstring } from '@hydrooj/utils';
import { Context } from '../context';
import { Setting as _Setting } from '../interface';
import { Logger } from '../logger';
@@ -386,7 +386,7 @@ export async function apply(ctx: Context) {
if (!setting.value) continue;
const current = await ctx.db.collection('system').findOne({ _id: setting.key });
if (!current || current.value == null || current.value === '') {
await retry(system.set, setting.key, setting.value);
await system.set(setting.key, setting.value);
}
}
try {