From 044c70ef33ba458aecaf80521cdaaa8340cc9738 Mon Sep 17 00:00:00 2001 From: t123yh Date: Sat, 2 Sep 2017 19:08:43 +0800 Subject: [PATCH] Fix isSupervisior async. --- modules/contest.js | 2 +- modules/submission.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/contest.js b/modules/contest.js index f1b4a54..8562f31 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -234,7 +234,7 @@ app.get('/contest/:id/ranklist', async (req, res) => { if (!contest) throw new ErrorMessage('无此比赛。'); if ([contest.allowedSeeingResult() && contest.allowedSeeingOthers(), contest.isEnded(), - contest.isSupervisior(curUser)].every(x => !x)) + await contest.isSupervisior(curUser)].every(x => !x)) throw new ErrorMessage('您没有权限进行此操作。'); await contest.loadRelationships(); diff --git a/modules/submission.js b/modules/submission.js index 30f7b7f..5c0b9a8 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -54,7 +54,7 @@ app.get('/submissions', async (req, res) => { const contest = await Contest.fromID(contestId); contest.ended = contest.isEnded(); if (contest.ended || // If the contest is ended - (curUser && contest.isSupervisior(curUser)) // Or if the user have the permission to check + (curUser && await contest.isSupervisior(curUser)) // Or if the user have the permission to check ) { where.type = { $eq: 1 }; where.type_info = { $eq: contestId };