Browse Source

Merge branch 'master' into submit-answer

pull/6/head
Menci 8 years ago committed by GitHub
parent
commit
ded3492755
  1. 2
      modules/user.js
  2. 2
      views/header.ejs
  3. 2
      views/problem.ejs

2
modules/user.js

@ -87,6 +87,7 @@ app.get('/user/:id', async (req, res) => {
try {
let id = parseInt(req.params.id);
let user = await User.fromID(id);
if (!user) throw new ErrorMessage('无此用户。');
user.ac_problems = await user.getACProblems();
user.articles = await user.getArticles();
user.allowedEdit = await user.isAllowedEditBy(res.locals.user);
@ -138,6 +139,7 @@ app.post('/user/:id/edit', async (req, res) => {
try {
let id = parseInt(req.params.id);
user = await User.fromID(id);
if (!user) throw new ErrorMessage('无此用户。');
let allowedEdit = await user.isAllowedEditBy(res.locals.user);
if (!allowedEdit) throw new ErrorMessage('您没有权限进行此操作。');

2
views/header.ejs

@ -1,6 +1,6 @@
<% include util %>
<!DOCTYPE html>
<html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">

2
views/problem.ejs

@ -242,6 +242,7 @@ if (contest) {
<script src="/libs/ace/ace.js"></script>
<script type="text/javascript">
var editor = ace.edit("editor");
var lastSubmitted = '';
editor.setTheme("ace/theme/tomorrow");
editor.getSession().setMode("ace/mode/" + $('#languages-menu .item.active').data('mode'));
@ -256,6 +257,7 @@ if (contest) {
function submit_code() {
if (!editor.getValue().trim()) return false;
$('#submit_code input[name=language]').val($('#languages-menu .item.active').data('value'));
lastSubmitted = editor.getValue();
$('#submit_code input[name=code]').val(editor.getValue());
return true;
}

Loading…
Cancel
Save