|
|
|
@ -194,7 +194,7 @@ app.get('/submission/:id', async (req, res) => {
|
|
|
|
|
|
|
|
|
|
let currentConfig = Object.assign({}, displayConfig); |
|
|
|
|
|
|
|
|
|
currentConfig.showRejudge = await judge.problem.isAllowedEditBy(res.locals.user); |
|
|
|
|
currentConfig.showRejudge = isAuthor || await judge.problem.isAllowedEditBy(res.locals.user, judge.user_id); |
|
|
|
|
if (isAdmin || isAuthor) { |
|
|
|
|
currentConfig.showShare = true; |
|
|
|
|
} |
|
|
|
@ -230,11 +230,15 @@ app.post('/submission/:id/rejudge', async (req, res) => {
|
|
|
|
|
let id = parseInt(req.params.id); |
|
|
|
|
let judge = await JudgeState.findById(id); |
|
|
|
|
|
|
|
|
|
if (judge.pending && !(res.locals.user && await res.locals.user.hasPrivilege('manage_problem'))) throw new ErrorMessage('无法重新评测一个评测中的提交。'); |
|
|
|
|
let curUser = res.locals.user; |
|
|
|
|
|
|
|
|
|
if (judge.pending && !(curUser && await curUser.hasPrivilege('manage_problem'))) throw new ErrorMessage('无法重新评测一个评测中的提交。'); |
|
|
|
|
|
|
|
|
|
await judge.loadRelationships(); |
|
|
|
|
|
|
|
|
|
let allowedRejudge = await judge.problem.isAllowedEditBy(res.locals.user); |
|
|
|
|
let isAuthor = curUser === null ? false : curUser.id === judge.user_id; |
|
|
|
|
|
|
|
|
|
let allowedRejudge = isAuthor || await judge.problem.isAllowedEditBy(res.locals.user, judge.user_id); |
|
|
|
|
if (!allowedRejudge) throw new ErrorMessage('您没有权限进行此操作。'); |
|
|
|
|
|
|
|
|
|
await judge.rejudge(); |
|
|
|
|