Fix permission of problem comments

This commit is contained in:
cuom1999 2021-12-17 15:46:13 -06:00
parent e4a595e3c8
commit 36f05abaeb
2 changed files with 9 additions and 4 deletions

View file

@ -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):

View file

@ -164,8 +164,11 @@
{% endif %}
<div><a href="{{ url('chronological_submissions', problem.code) }}">{{ _('All submissions') }}</a></div>
<div><a href="{{ url('ranked_submissions', problem.code) }}">{{ _('Best submissions') }}</a></div>
{% if not contest_problem or not contest_problem.contest.use_clarifications %}
<hr>
<div><a href="{{ url('problem_comments', problem.code) }}">{{ _('Discuss') }}</a></div>
{% endif %}
{% if editorial and editorial.is_public and
not (request.user.is_authenticated and request.profile.current_contest) %}
<div><a href="{{ url('problem_editorial', problem.code) }}">{{ _('Read editorial') }}</a></div>