From 36f05abaebfbf10015748deea8ef320f86493e8f Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Fri, 17 Dec 2021 15:46:13 -0600 Subject: [PATCH] Fix permission of problem comments --- judge/comments.py | 6 ++++-- templates/problem/problem.html | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/judge/comments.py b/judge/comments.py index 6e7c7e6..7408e68 100644 --- a/judge/comments.py +++ b/judge/comments.py @@ -80,8 +80,10 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View): return self.comment_page def is_comment_locked(self): - return (CommentLock.objects.filter(page=self.get_comment_page()).exists() and - not self.request.user.has_perm('judge.override_comment_lock')) + if self.request.user.has_perm('judge.override_comment_lock'): + return False + return (CommentLock.objects.filter(page=self.get_comment_page()).exists() + or (self.request.in_contest and self.request.participation.contest.use_clarifications)) @method_decorator(login_required) def post(self, request, *args, **kwargs): diff --git a/templates/problem/problem.html b/templates/problem/problem.html index a0e24a3..43e9ddb 100644 --- a/templates/problem/problem.html +++ b/templates/problem/problem.html @@ -164,8 +164,11 @@ {% endif %}
{{ _('All submissions') }}
{{ _('Best submissions') }}
-
-
{{ _('Discuss') }}
+ + {% if not contest_problem or not contest_problem.contest.use_clarifications %} +
+
{{ _('Discuss') }}
+ {% endif %} {% if editorial and editorial.is_public and not (request.user.is_authenticated and request.profile.current_contest) %}
{{ _('Read editorial') }}