From b73afc7af6b46e11dab62526611ba8444720a877 Mon Sep 17 00:00:00 2001 From: panda Date: Thu, 17 Aug 2023 06:39:35 +0800 Subject: [PATCH] core: fix owner display on problem & contest (#614) --- packages/hydrooj/src/handler/discussion.ts | 1 + packages/hydrooj/src/handler/problem.ts | 1 + packages/ui-default/templates/contest_user.html | 2 +- packages/ui-default/templates/partials/problem_sidebar.html | 6 +++--- packages/ui-default/templates/problem_config.html | 1 - packages/ui-default/templates/problem_detail.html | 1 - packages/ui-default/templates/problem_edit.html | 1 - packages/ui-default/templates/problem_files.html | 1 - packages/ui-default/templates/problem_hack.html | 1 - packages/ui-default/templates/problem_submit.html | 1 - 10 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index ad140c8a5..213ecbfd4 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -173,6 +173,7 @@ class DiscussionDetailHandler extends DiscussionHandler { system.get('pagination.reply'), ); const uids = [ + ...this.vnode.owner ? [this.vnode.owner] : [], this.ddoc.owner, ...drdocs.map((drdoc) => drdoc.owner), ]; diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 0d49eb204..ad724b5f5 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -376,6 +376,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler { solutionCount: scnt, discussionCount: dcnt, tdoc: this.tdoc, + owner_udoc: (tid && this.tdoc.owner !== this.pdoc.owner) ? await user.getById(domainId, this.tdoc.owner) : null, }; if (this.tdoc && this.tsdoc) { const fields = ['attend', 'startAt']; diff --git a/packages/ui-default/templates/contest_user.html b/packages/ui-default/templates/contest_user.html index 5641730dd..a538adbc1 100644 --- a/packages/ui-default/templates/contest_user.html +++ b/packages/ui-default/templates/contest_user.html @@ -41,7 +41,7 @@
{% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar.html" %} + {% include "partials/contest_sidebar_management.html" %}
{% endblock %} diff --git a/packages/ui-default/templates/partials/problem_sidebar.html b/packages/ui-default/templates/partials/problem_sidebar.html index 918a6e52e..c3d8fc2be 100644 --- a/packages/ui-default/templates/partials/problem_sidebar.html +++ b/packages/ui-default/templates/partials/problem_sidebar.html @@ -1,7 +1,7 @@ +{% if not owner_udoc %} + {% set owner_udoc = udoc %} +{% endif %} {% if tdoc %} - {% if not owner_udoc %} - {% set owner_udoc = udoc %} - {% endif %} {% if tdoc.rule == 'homework' %} {% include "partials/problem_sidebar_homework.html" %} {% include "partials/homework_sidebar.html" %} diff --git a/packages/ui-default/templates/problem_config.html b/packages/ui-default/templates/problem_config.html index 611df3991..dff8e7ba5 100644 --- a/packages/ui-default/templates/problem_config.html +++ b/packages/ui-default/templates/problem_config.html @@ -32,7 +32,6 @@ {% set filetype = "testdata" %} {% include "partials/problem_files.html" %} - {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %} diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index 08a81d902..2e9b93b3c 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -111,7 +111,6 @@
- {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %}
diff --git a/packages/ui-default/templates/problem_edit.html b/packages/ui-default/templates/problem_edit.html index 8db72bc3b..43f95bad0 100644 --- a/packages/ui-default/templates/problem_edit.html +++ b/packages/ui-default/templates/problem_edit.html @@ -110,7 +110,6 @@ {% set filetype = "additional_file" %} {% include "partials/problem_files.html" %} - {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %} {% else %} {% include 'components/md_hint.html' %} diff --git a/packages/ui-default/templates/problem_files.html b/packages/ui-default/templates/problem_files.html index ac01788b1..c6c4b2871 100644 --- a/packages/ui-default/templates/problem_files.html +++ b/packages/ui-default/templates/problem_files.html @@ -48,7 +48,6 @@
- {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %}
diff --git a/packages/ui-default/templates/problem_hack.html b/packages/ui-default/templates/problem_hack.html index 72c3f2bb8..65054de93 100644 --- a/packages/ui-default/templates/problem_hack.html +++ b/packages/ui-default/templates/problem_hack.html @@ -24,7 +24,6 @@
- {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %}
diff --git a/packages/ui-default/templates/problem_submit.html b/packages/ui-default/templates/problem_submit.html index b160cdaa6..2da9691d9 100644 --- a/packages/ui-default/templates/problem_submit.html +++ b/packages/ui-default/templates/problem_submit.html @@ -33,7 +33,6 @@
- {% set owner_udoc = udoc %} {% include "partials/problem_sidebar.html" %}