1
0
Fork 0

Notify admins when a report is filed

This commit is contained in:
Mouse Reeve 2021-03-16 12:57:23 -07:00
parent 37dd661e49
commit e5750de3dd
4 changed files with 60 additions and 2 deletions

View file

@ -5,7 +5,7 @@ from .base_model import BookWyrmModel
NotificationType = models.TextChoices(
"NotificationType",
"FAVORITE REPLY MENTION TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT ADD",
"FAVORITE REPLY MENTION TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT ADD REPORT",
)
@ -22,6 +22,7 @@ class Notification(BookWyrmModel):
related_list_item = models.ForeignKey(
"ListItem", on_delete=models.CASCADE, null=True
)
related_report = models.ForeignKey("Report", on_delete=models.CASCADE, null=True)
read = models.BooleanField(default=False)
notification_type = models.CharField(
max_length=255, choices=NotificationType.choices
@ -37,6 +38,7 @@ class Notification(BookWyrmModel):
related_status=self.related_status,
related_import=self.related_import,
related_list_item=self.related_list_item,
related_report=self.related_report,
notification_type=self.notification_type,
).exists():
return