feat: Only show edit buttons when mod

This commit is contained in:
moanos [he/him] 2025-03-09 18:05:03 +01:00
parent 9ae64e8cb1
commit 5ad0cb74cc
2 changed files with 17 additions and 13 deletions

View File

@ -16,16 +16,18 @@
<p><b>{% translate "Kommentar zur Meldung" %}:</b>
{{ report.user_comment }}
</p>
<div class="container-edit-buttons">
<form action="allow" class="">
{% csrf_token %}
<input type="hidden" name="report_id" value="{{ report.pk }}">
<button class="btn allow" type="submit">{% translate "Inhalt genehmigen" %}</button>
</form>
<form action="disallow" class="">
{% csrf_token %}
<input type="hidden" name="report_id" value="{{ report.pk }}">
<button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button>
</form>
</div>
{% if is_mod_or_above %}
<div class="container-edit-buttons">
<form action="allow" class="">
{% csrf_token %}
<input type="hidden" name="report_id" value="{{ report.pk }}">
<button class="btn allow" type="submit">{% translate "Inhalt genehmigen" %}</button>
</form>
<form action="disallow" class="">
{% csrf_token %}
<input type="hidden" name="report_id" value="{{ report.pk }}">
<button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button>
</form>
</div>
{% endif %}
</div>

View File

@ -431,8 +431,10 @@ def report_detail(request, report_id, form_complete=False):
"""
report = Report.objects.get(pk=report_id)
moderation_actions = ModerationAction.objects.filter(report_id=report_id)
is_mod_or_above = user_is_trust_level_or_above(request.user, TrustLevel.MODERATOR)
context = {"report": report, "moderation_actions": moderation_actions, "form_complete": form_complete}
context = {"report": report, "moderation_actions": moderation_actions,
"form_complete": form_complete, "is_mod_or_above": is_mod_or_above}
return render(request, 'fellchensammlung/details/detail-report.html', context)