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,6 +16,7 @@
<p><b>{% translate "Kommentar zur Meldung" %}:</b> <p><b>{% translate "Kommentar zur Meldung" %}:</b>
{{ report.user_comment }} {{ report.user_comment }}
</p> </p>
{% if is_mod_or_above %}
<div class="container-edit-buttons"> <div class="container-edit-buttons">
<form action="allow" class=""> <form action="allow" class="">
{% csrf_token %} {% csrf_token %}
@ -28,4 +29,5 @@
<button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button> <button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button>
</form> </form>
</div> </div>
{% endif %}
</div> </div>

View File

@ -431,8 +431,10 @@ def report_detail(request, report_id, form_complete=False):
""" """
report = Report.objects.get(pk=report_id) report = Report.objects.get(pk=report_id)
moderation_actions = ModerationAction.objects.filter(report_id=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) return render(request, 'fellchensammlung/details/detail-report.html', context)