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> <p><b>{% translate "Kommentar zur Meldung" %}:</b>
{{ report.user_comment }} {{ report.user_comment }}
</p> </p>
<div class="container-edit-buttons"> {% if is_mod_or_above %}
<form action="allow" class=""> <div class="container-edit-buttons">
{% csrf_token %} <form action="allow" class="">
<input type="hidden" name="report_id" value="{{ report.pk }}"> {% csrf_token %}
<button class="btn allow" type="submit">{% translate "Inhalt genehmigen" %}</button> <input type="hidden" name="report_id" value="{{ report.pk }}">
</form> <button class="btn allow" type="submit">{% translate "Inhalt genehmigen" %}</button>
<form action="disallow" class=""> </form>
{% csrf_token %} <form action="disallow" class="">
<input type="hidden" name="report_id" value="{{ report.pk }}"> {% csrf_token %}
<button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button> <input type="hidden" name="report_id" value="{{ report.pk }}">
</form> <button class="btn allow" type="submit">{% translate "Inhalt als gesperrt kennzeichnen" %}</button>
</div> </form>
</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)