feat: Add mod need for modqueue

This commit is contained in:
moanos [he/him] 2024-08-06 17:38:17 +02:00
parent cabfc1614b
commit 97b19a3b6e

View File

@ -19,6 +19,11 @@ from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageFo
from .models import Language, Announcement from .models import Language, Announcement
from .tools.geo import GeoAPI from .tools.geo import GeoAPI
from .tools.metrics import gather_metrics_data from .tools.metrics import gather_metrics_data
from django.contrib.auth.decorators import user_passes_test
def user_is_mod_or_above(user):
return user.is_authenticated and user.trust_level > User.TRUST_LEVEL[User.MODERATOR]
def index(request): def index(request):
@ -316,6 +321,7 @@ def report_detail_success(request, report_id):
return report_detail(request, report_id, form_complete=True) return report_detail(request, report_id, form_complete=True)
@login_required
def user_detail(request, user_id): def user_detail(request, user_id):
if request.method == "POST": if request.method == "POST":
action = request.POST.get("action") action = request.POST.get("action")
@ -338,6 +344,7 @@ def user_detail(request, user_id):
return render(request, 'fellchensammlung/details/detail-user.html', context=context) return render(request, 'fellchensammlung/details/detail-user.html', context=context)
@user_passes_test(user_is_mod_or_above)
def modqueue(request): def modqueue(request):
open_reports = Report.objects.filter(status=Report.WAITING) open_reports = Report.objects.filter(status=Report.WAITING)
context = {"reports": open_reports} context = {"reports": open_reports}