core: fix pretest display

This commit is contained in:
undefined committed 2021-09-24 17:56:26 +08:00
1 parent a2f1e886db
commit 71bb2f0b51
5 files changed
+14 -6

No files matched your search

+3 -1
View File
@@ -107,7 +107,9 @@ class RecordDetailHandler extends Handler {
this.response.template = 'record_detail.html';
const rdoc = await record.get(domainId, rid);
if (!rdoc) throw new RecordNotFoundError(rid);
if (rdoc.contest) {
if (rdoc.contest.toHexString() === '000000000000000000000000') {
if (rdoc.uid !== this.user._id) throw new PermissionError(PERM.PERM_READ_RECORD_CODE);
} else if (rdoc.contest) {
const tdoc = await contest.get(domainId, rdoc.contest);
let canView = this.user.own(tdoc);
canView ||= contest.canShowRecord.call(this, tdoc);