Browse Source

Fix isSupervisior async.

pull/6/head
t123yh 7 years ago
parent
commit
044c70ef33
  1. 2
      modules/contest.js
  2. 2
      modules/submission.js

2
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();

2
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 };

Loading…
Cancel
Save