Skip to content

Commit

Permalink
Merge pull request #6364 from akatsoulas/lock-moderated-question
Browse files Browse the repository at this point in the history
Do not edit moderated questions
  • Loading branch information
akatsoulas authored Nov 21, 2024
2 parents 7a4802f + 2b5dc20 commit 878177e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kitsune/questions/jinja2/questions/question_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ <h3 class="sumo-card-heading">{{ _('Post a Reply') }}</h3>
{% endif %}
</div>
</li>
{% if is_trusted_user(request.user) %}
{% if not question.is_moderated and is_trusted_user(request.user) %}
<li class="mzp-c-details">
<h3 class="sidebar-subheading sidebar-nav--heading-item is-accordion-heading">{{ _('Question Details') }}</h3>
<div id="question-details" class="question-details">
Expand Down
9 changes: 9 additions & 0 deletions kitsune/questions/models.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()."""
Expand Down

0 comments on commit 878177e

Please sign in to comment.