Browse Source

Fix can't submit contest problems

pull/6/head
Menci 8 years ago
parent
commit
e58ece5843
  1. 2
      modules/problem.js

2
modules/problem.js

@ -213,7 +213,6 @@ app.post('/submit/:id', async (req, res) => {
if (!problem) throw 'No such problem.';
if (!syzoj.config.languages[req.body.language]) throw 'No such language.'
if (!res.locals.user) throw 'Please login.';
if (!await problem.isAllowedUseBy(res.locals.user)) throw 'Permission denied.';
let judge_state = await JudgeState.create({
code: req.body.code,
@ -235,6 +234,7 @@ app.post('/submit/:id', async (req, res) => {
await judge_state.save();
await judge_state.updateRelatedInfo();
} else {
if (!await problem.isAllowedUseBy(res.locals.user)) throw 'Permission denied.';
judge_state.type = problem.is_public ? 0 : 2;
await judge_state.save();
}

Loading…
Cancel
Save