ui: allow admin view contest problem (#419)

This commit is contained in:
guke1024 authored and GitHub committed 2022-08-23 16:03:54 +08:00
1 parent e06c86e9dd
commit efbc3c0162
6 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "3.16.0", "version": "3.16.1",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+1 -1
View File
@@ -127,7 +127,7 @@ export class ContestDetailHandler extends ContestDetailBaseHandler {
.replace(/="file:\/\//g, `="./${this.tdoc.docId}/file/`); .replace(/="file:\/\//g, `="./${this.tdoc.docId}/file/`);
} }
if ( if (
(contest.isNotStarted(this.tdoc) || !this.tsdoc?.attend) (contest.isNotStarted(this.tdoc) || (!this.tsdoc?.attend && !contest.isDone(this.tdoc)))
&& !this.user.own(this.tdoc) && !this.user.own(this.tdoc)
&& !this.user.hasPerm(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD) && !this.user.hasPerm(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)
) return; ) return;
+1 -1
View File
@@ -74,7 +74,7 @@ class HomeworkDetailHandler extends Handler {
tdoc, tsdoc, udict, ddocs, page, dpcount, dcount, tdoc, tsdoc, udict, ddocs, page, dpcount, dcount,
}; };
if ( if (
(contest.isNotStarted(tdoc) || !tsdoc?.attend) (contest.isNotStarted(tdoc) || (!tsdoc?.attend && !contest.isDone(tdoc)))
&& !this.user.own(tdoc) && !this.user.own(tdoc)
&& !this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD) && !this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD)
) return; ) return;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.39.9", "version": "4.39.10",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -61,6 +61,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% set isAdmin = handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD) %}
{% set ntdoc = model.contest.isDone(tdoc) or (tsdoc.attend and not model.contest.isNotStarted(tdoc)) %}
{%- for pid in tdoc.pids -%} {%- for pid in tdoc.pids -%}
<tr> <tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
@@ -78,7 +80,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<td class="col--problem col--problem-name"> <td class="col--problem col--problem-name">
{% if model.contest.isNotStarted(tdoc) %} {% if isAdmin and not ntdoc %}
{{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }} {{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }}
{% else %} {% else %}
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }} {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
@@ -36,6 +36,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% set isAdmin = handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD) %}
{% set ntdoc = model.contest.isDone(tdoc) or (tsdoc.attend and not model.contest.isNotStarted(tdoc)) %}
{%- for pid in tdoc.pids -%} {%- for pid in tdoc.pids -%}
<tr> <tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
@@ -53,7 +55,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<td class="col--problem col--problem-name"> <td class="col--problem col--problem-name">
{% if model.contest.isNotStarted(tdoc) %} {% if isAdmin and not ntdoc %}
{{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }} {{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }}
{% else %} {% else %}
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }} {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}