core: use canShowSelfRecord

This commit is contained in:
undefined committed 2021-08-05 15:50:16 +08:00
1 parent d7afcab59d
commit 4dd428ba35
7 files changed
+9 -9

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.30.12",
"version": "2.30.13",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+2 -2
View File
@@ -60,7 +60,7 @@ export class ContestDetailHandler extends Handler {
if (tsdoc) {
attended = tsdoc.attend === 1;
for (const pdetail of tsdoc.journal || []) psdict[pdetail.pid] = pdetail;
if (contest.canShowRecord.call(this, tdoc)) {
if (contest.canShowSelfRecord.call(this, tdoc)) {
const q = [];
for (const i in psdict) q.push(psdict[i].rid);
rdict = await record.getList(domainId, q, true);
@@ -373,7 +373,7 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
]);
}
bus.boardcast('record/change', rdoc);
if (!pretest && !contest.canShowRecord.call(this, this.tdoc)) {
if (!pretest && !contest.canShowSelfRecord.call(this, this.tdoc)) {
this.response.body = { tid };
this.response.redirect = this.url('contest_detail', { tid });
} else {
+2 -2
View File
@@ -68,7 +68,7 @@ class HomeworkDetailHandler extends Handler {
psdict[pdetail.pid] = pdetail;
rdict[pdetail.rid] = { _id: pdetail.rid };
}
if (contest.canShowRecord.call(this, tdoc) && tsdoc.journal) {
if (contest.canShowSelfRecord.call(this, tdoc) && tsdoc.journal) {
rdict = await record.getList(
domainId,
tsdoc.journal.map((pdetail) => pdetail.rid),
@@ -243,7 +243,7 @@ class HomeworkDetailProblemSubmitHandler extends HomeworkDetailProblemHandler {
bus.boardcast('record/change', rdoc);
this.response.body.tid = tid;
this.response.body.rid = rid;
if (pretest || contest.canShowRecord.call(this, this.tdoc)) this.response.redirect = this.url('record_detail', { rid });
if (pretest || contest.canShowSelfRecord.call(this, this.tdoc)) this.response.redirect = this.url('record_detail', { rid });
else this.response.redirect = this.url('homework_detail', { tid });
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.14.11",
"version": "4.14.12",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -45,7 +45,7 @@
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowRecord.call(handler, tdoc) %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
@@ -44,7 +44,7 @@
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowRecord.call(handler, tdoc) %}
{% if model.contest.canShowSelfRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
@@ -10,7 +10,7 @@
pdoc: pdoc
}) }}
{% if tdoc %}
{{ set(UiContext, 'canViewRecord', model.contest.canShowRecord.call(handler, tdoc)) }}
{{ set(UiContext, 'canViewRecord', model.contest.canShowSelfRecord.call(handler, tdoc)) }}
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
{{ set(UiContext, 'getSubmissionsUrl', url('record_main', query={fullStatus:'true', pid:pdoc.pid, tid:tdoc.docId})) }}
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}