Add auto-approval for moderator submissions and update submission handling

This commit is contained in:
pacnpal
2025-02-05 18:47:23 -05:00
parent 1ef38f4a96
commit bc68eaf4d9
30 changed files with 21 additions and 9 deletions

View File

@@ -277,6 +277,16 @@ class PhotoSubmission(models.Model):
self.handled_at = timezone.now()
self.notes = notes
self.save()
def auto_approve(self) -> None:
"""Auto-approve submissions from moderators"""
# Get user role safely
user_role = getattr(self.user, "role", None)
# If user is moderator or above, auto-approve
if user_role in ["MODERATOR", "ADMIN", "SUPERUSER"]:
self.approve(self.user)
def escalate(self, moderator: UserType, notes: str = "") -> None:
"""Escalate the photo submission to admin"""