mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core&ui: allow admin view contest submissions
This commit is contained in:
1 parent
7f7d674dc4
commit
4fa9df8c9b
4 files changed
+15
-8
No files matched your search
@@ -88,7 +88,7 @@ export async function locale(pending: string[], fail: string[]) {
|
||||
logger.info('Locale init: %s', i);
|
||||
} catch (e) {
|
||||
fail.push(i);
|
||||
app.inject('Notification', 'Locale load fail: {0}', { args: [i] }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
app.inject('Notification', 'Locale load fail: {0}', { args: [i], type: 'warn' }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
logger.error('Locale Load Fail: %s', i);
|
||||
logger.error(e);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ export async function setting(pending: string[], fail: string[], modelSetting: t
|
||||
}
|
||||
logger.info('Config load: %s', i);
|
||||
} catch (e) {
|
||||
app.inject('Notification', 'Config load fail: {0}', { args: [i] }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
app.inject('Notification', 'Config load fail: {0}', { args: [i], type: 'warn' }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
logger.error('Config Load Fail: %s', i);
|
||||
logger.error(e);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export async function template(pending: string[], fail: string[]) {
|
||||
logger.info('Template init: %s', i);
|
||||
} catch (e) {
|
||||
fail.push(i);
|
||||
app.inject('Notification', 'Template load fail: {0}', { args: [i] }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
app.inject('Notification', 'Template load fail: {0}', { args: [i], type: 'warn' }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
logger.error('Template Load Fail: %s', i);
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
||||
uidOrName?: string, lang?: string, status?: number, full = false,
|
||||
all = false,
|
||||
) {
|
||||
const notification = [];
|
||||
let tdoc = null;
|
||||
let invalid = false;
|
||||
this.response.template = 'record_main.html';
|
||||
@@ -46,8 +47,13 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
||||
this.tdoc = tdoc;
|
||||
if (!tdoc) throw new ContestNotFoundError(domainId, pid);
|
||||
if (!contest.canShowScoreboard.call(this, tdoc, true)) throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||
if (!this.user.own(tdoc) && !(await contest.getStatus(domainId, tid, this.user._id))?.attend) {
|
||||
throw new ContestNotAttendedError(domainId, tid);
|
||||
if (!(await contest.getStatus(domainId, tid, this.user._id))?.attend) {
|
||||
if (contest.canShowRecord.call(this, tdoc, true)) {
|
||||
const name = tdoc.rule === 'homework'
|
||||
? "You haven't claimed this homework yet."
|
||||
: "You haven't attended this contest yet.";
|
||||
notification.push({ name, args: { type: 'note' }, checker: () => true });
|
||||
} else throw new ContestNotAttendedError(domainId, tid);
|
||||
}
|
||||
}
|
||||
if (uidOrName) {
|
||||
@@ -98,6 +104,7 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
||||
filterUidOrName: uidOrName,
|
||||
filterLang: lang,
|
||||
filterStatus: status,
|
||||
notification,
|
||||
};
|
||||
if (this.user.hasPriv(PRIV.PRIV_VIEW_JUDGE_STATISTICS) && !full) {
|
||||
this.response.body.statistics = await record.stat(all ? undefined : domainId);
|
||||
|
||||
@@ -97,7 +97,7 @@ export function addon(addonPath: string, prepend = false) {
|
||||
} catch (e) {
|
||||
logger.error(`Addon not found: ${addonPath}`);
|
||||
logger.error(e);
|
||||
inject('Notification', 'Addon not found: {0}', { args: [addonPath] }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
inject('Notification', 'Addon not found: {0}', { args: [addonPath], type: 'warn' }, PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<div class="slideout-overlay"></div>
|
||||
{% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %}
|
||||
<div class="main">
|
||||
{% for item in ui.getNodes('Notification') %}{% if item.checker(handler) %}
|
||||
<div class="row"><blockquote class="warn">{{ _(item.name).format(item.args.args or []) }}</blockquote></div>
|
||||
{% for item in ui.getNodes('Notification').concat(notification or []) %}{% if item.checker(handler) %}
|
||||
<div class="row"><blockquote class="{{ item.args.type }}">{{ _(item.name).format(item.args.args or []) }}</blockquote></div>
|
||||
{% endif %}{% endfor %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user