From 2b5dc20cce865615ae8545824d65afa9c16d2f52 Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas Date: Wed, 20 Nov 2024 19:01:43 +0200 Subject: [PATCH] Do not edit moderated questions --- kitsune/questions/jinja2/questions/question_details.html | 2 +- kitsune/questions/models.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kitsune/questions/jinja2/questions/question_details.html b/kitsune/questions/jinja2/questions/question_details.html index 6eb63addc63..a0f72c52033 100644 --- a/kitsune/questions/jinja2/questions/question_details.html +++ b/kitsune/questions/jinja2/questions/question_details.html @@ -435,7 +435,7 @@

{{ _('Post a Reply') }}

{% endif %} - {% if is_trusted_user(request.user) %} + {% if not question.is_moderated and is_trusted_user(request.user) %}
  • diff --git a/kitsune/questions/models.py b/kitsune/questions/models.py index ce2e07eb438..a1dba3a3063 100755 --- a/kitsune/questions/models.py +++ b/kitsune/questions/models.py @@ -1,6 +1,7 @@ import logging import re from datetime import datetime, timedelta +from functools import cached_property from urllib.parse import urlparse import actstream @@ -392,6 +393,14 @@ def is_solved(self): def is_offtopic(self): return config.OFFTOPIC_TAG_NAME in [t.name for t in self.my_tags] + @cached_property + def is_moderated(self): + return ( + self.flags.filter(reason=FlaggedObject.REASON_CONTENT_MODERATION) + .exclude(status=FlaggedObject.FLAG_PENDING) + .exists() + ) + @property def my_tags(self): """A caching wrapper around self.tags.all()."""