mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: bug fixes
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -807,8 +807,8 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
|||||||
@post('std', Types.Filename)
|
@post('std', Types.Filename)
|
||||||
@post('gen', Types.Filename)
|
@post('gen', Types.Filename)
|
||||||
async postGenerateTestdata(domainId: string, std: string, gen: string) {
|
async postGenerateTestdata(domainId: string, std: string, gen: string) {
|
||||||
if (!this.pdoc.data.find((i) => i.name === std)) throw new BadRequestError();
|
if (!this.pdoc.data?.find((i) => i.name === std)) throw new BadRequestError();
|
||||||
if (!this.pdoc.data.find((i) => i.name === gen)) throw new BadRequestError();
|
if (!this.pdoc.data?.find((i) => i.name === gen)) throw new BadRequestError();
|
||||||
const rid = await record.add(domainId, this.pdoc.docId, this.user._id, '_', `${gen}\n${std}`, true, {
|
const rid = await record.add(domainId, this.pdoc.docId, this.user._id, '_', `${gen}\n${std}`, true, {
|
||||||
type: 'generate',
|
type: 'generate',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
|||||||
if (this.tdoc.allowViewCode && contest.isDone(this.tdoc)) {
|
if (this.tdoc.allowViewCode && contest.isDone(this.tdoc)) {
|
||||||
canViewCode ||= tsdoc?.attend;
|
canViewCode ||= tsdoc?.attend;
|
||||||
}
|
}
|
||||||
if (!tsdoc?.attend && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
if (!tsdoc?.attend && pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
||||||
} else if (pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
} else if (pdoc && !problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
||||||
if (!canViewCode) {
|
if (!canViewCode) {
|
||||||
rdoc.code = '';
|
rdoc.code = '';
|
||||||
|
|||||||
Reference in new issue
Block a user