This commit is contained in:
undefined committed 2022-01-24 00:00:37 +08:00
1 parent 688ccf811b
commit 775301c001
7 files changed
+26 -45

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "3.3.14", "version": "3.3.15",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+3 -1
View File
@@ -301,15 +301,17 @@ class UserDetailHandler extends Handler {
const pdocs: ProblemDoc[] = []; const pdocs: ProblemDoc[] = [];
const acInfo: Record<string, number> = {}; const acInfo: Record<string, number> = {};
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id; const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id;
if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) {
await Promise.all([domainId, ...(union?.union || [])].map(async (did) => { await Promise.all([domainId, ...(union?.union || [])].map(async (did) => {
const psdocs = await problem.getMultiStatus(did, { uid, status: STATUS.STATUS_ACCEPTED }).toArray(); const psdocs = await problem.getMultiStatus(did, { uid, status: STATUS.STATUS_ACCEPTED }).toArray();
pdocs.push(...Object.values( pdocs.push(...Object.values(
await problem.getList( await problem.getList(
did, psdocs.map((i) => i.docId), canViewHidden, did, psdocs.map((i) => i.docId), canViewHidden,
this.user.group, false, undefined, true, this.user.group, false, problem.PROJECTION_LIST, true,
), ),
)); ));
})); }));
}
for (const pdoc of pdocs) { for (const pdoc of pdocs) {
for (const tag of pdoc.tag) { for (const tag of pdoc.tag) {
if (acInfo[tag]) acInfo[tag]++; if (acInfo[tag]) acInfo[tag]++;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.30.4", "version": "4.30.5",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -3,7 +3,7 @@
{% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %} {% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %}
{% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %} {% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %}
{% if pdoc.domainId !== handler.domainId %}{{ set(_linkArgs, 'domainId', pdoc.domainId) }}{% endif %} {% if pdoc.domainId !== handler.domainId %}{{ set(_linkArgs, 'domainId', pdoc.domainId) }}{% endif %}
<a href="{{ url('problem_detail', _linkArgs) }}"{% if small %}data-tooltip="{{ pdoc.title }}"{% endif %}> <a href="{{ url('problem_detail', _linkArgs) }}"{% if small %} data-tooltip="{{ pdoc.title }}"{% endif %}>
{%- endif -%} {%- endif -%}
{%- if pdoc.domainId !== handler.domainId -%} {%- if pdoc.domainId !== handler.domainId -%}
{{ pdoc.domainId }}# {{ pdoc.domainId }}#
@@ -1,4 +1,4 @@
{% macro render_item(icon_name, page_name, args={}, label=none, menu_item=none) %} {% macro render_item(icon_name, page_name, args={}, label=none, menu_item) %}
{% set target_url = url(page_name, args) if page_name else '#' %} {% set target_url = url(page_name, args) if page_name else '#' %}
<li class="menu__item" id="menu-item-{{ menu_item|default(page_name) }}"> <li class="menu__item" id="menu-item-{{ menu_item|default(page_name) }}">
<a href="{{ target_url }}" class="menu__link{% if handler.request.path == target_url %} active{% endif %}"> <a href="{{ target_url }}" class="menu__link{% if handler.request.path == target_url %} active{% endif %}">
@@ -21,12 +21,12 @@
{% block ogp %} {% block ogp %}
<meta property="og:site_name" content="{{ (handler.domain|default({ui:[]})).ui.name|default(model.system.get('server.name')) }}" /> <meta property="og:site_name" content="{{ (handler.domain|default({ui:[]})).ui.name|default(model.system.get('server.name')) }}" />
<meta property="og:title" content="{{ handler.renderTitle(page_name) }}" /> <meta property="og:title" content="{{ handler.renderTitle(page_name) }}" />
<meta property="og:url" content="{{ model.system.get('server.url') }}{{ handler.ctx.request.path }}" /> <meta property="og:url" content="{{ model.system.get('server.url') }}{{ handler.ctx.request.path.slice(1) }}" />
<meta property="og:image" content="{{ static_url('favicon-96x96.png') }}" /> <meta property="og:image" content="{{ static_url('favicon-96x96.png') }}" />
{% endblock %} {% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %} {% if not isIE(handler.request.headers['user-agent']) %}
<script src="{{ static_url((handler.user|default({})).theme|default('default') + '.theme.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script> <script src="{{ static_url((handler.user|default({})).theme|default('default') + '.theme.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script>
<script type="text/javascript" src="{{ static_url('l/'+handler.user.viewLang) }}"></script> <script type="text/javascript" src="{{ static_url('l/'+_('__id')) }}"></script>
{% if process.env.DEV %} {% if process.env.DEV %}
<script type="text/javascript" src="{{ static_url('hydro.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script> <script type="text/javascript" src="{{ static_url('hydro.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script>
{% else %} {% else %}
@@ -46,11 +46,5 @@
</head> </head>
<body> <body>
{% block body %}{% endblock %} {% block body %}{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
<script>
UiContext = '{{ UiContext|json|jsesc|safe }}';
UserContext = '{{ UserContext|json|jsesc|safe }}';
</script>
{% endif %}
</body> </body>
</html> </html>
+17 -32
View File
@@ -103,48 +103,31 @@
</div> </div>
</div> </div>
</div> </div>
{% if pdocs.length %}
<div class="section"> <div class="section">
<div class="section__header"> <div class="section__header">
<h2 class="section__title">{{ _('Accepted Problems') }}</h2> <h2 class="section__title">{{ _('Accepted Problems') }}</h2>
</div> </div>
<div class="typo section__body no-media"> <div class="typo section__body no-media">
{% set _mark = Math.ceil(pdocs.length/4) %} {% set _mark = Math.ceil(pdocs.length/4) %}
{% set _one = pdocs.slice(0, _mark) %} {% macro col(pdocs) %}
{% set _two = pdocs.slice(_mark, _mark*2) %} <div class="medium-3 columns">
{% set _three = pdocs.slice(_mark*2, _mark*3) %} <ul>
{% set _four = pdocs.slice(_mark*3, pdocs.length - 1) %} {% for pdoc in pdocs %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
{% endmacro %}
<div class="row"> <div class="row">
<div class="medium-3 columns"> {{ col(pdocs.slice(0, _mark)) }}
<ul> {{ col(pdocs.slice(_mark, _mark*2)) }}
{% for pdoc in _one %} {{ col(pdocs.slice(_mark*2, _mark*3)) }}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li> {{ col(pdocs.slice(_mark*3, pdocs.length - 1)) }}
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _two %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _three %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _four %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
</div> </div>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
<div class="medium-3 columns"> <div class="medium-3 columns">
{% if isSelfProfile %} {% if isSelfProfile %}
@@ -174,6 +157,7 @@
</div> </div>
</div> </div>
</div> </div>
{% if tags.length %}
<div class="section side"> <div class="section side">
<div class="section__header"> <div class="section__header">
<h2 class="section__title">{{ _('Problem Tags') }}</h2> <h2 class="section__title">{{ _('Problem Tags') }}</h2>
@@ -187,6 +171,7 @@
</dl> </dl>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}