From c1bd317e973c942f09b33374687c39e85dcb545e Mon Sep 17 00:00:00 2001 From: panda Date: Thu, 11 May 2023 10:53:01 +0800 Subject: [PATCH] core: fix accept check on problem solution (#574) --- packages/hydrooj/src/handler/problem.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index c94ec990d..c9c9102a8 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -822,7 +822,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler { async get(domainId: string, page = 1, tid?: ObjectId, sid?: ObjectId) { if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION); this.response.template = 'problem_solution.html'; - const accepted = this.tsdoc?.status === STATUS.STATUS_ACCEPTED; + const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED; if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) { this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION); } @@ -933,7 +933,7 @@ export class ProblemSolutionRawHandler extends ProblemDetailHandler { @param('tid', Types.ObjectId, true) async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) { if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION); - const accepted = this.tsdoc?.status === STATUS.STATUS_ACCEPTED; + const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED; if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) { this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION); }