Notification field is read, not unread

Oops
This commit is contained in:
Mouse Reeve 2022-07-04 21:32:35 -07:00
parent 801ba03aaf
commit 971bed9942
2 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ def automod_task():
with transaction.atomic():
for admin in admins:
notification, _ = notification_model.objects.get_or_create(
user=admin, notification_type=notification_model.REPORT, unread=True
user=admin, notification_type=notification_model.REPORT, read=False
)
notification.related_repors.add(reports)

View file

@ -61,7 +61,7 @@ class Notification(BookWyrmModel):
return
notification, _ = cls.objects.get_or_create(user=user, **kwargs)
notification.related_users.add(related_user)
notification.unread = True
notification.read = False
notification.save()
@classmethod
@ -72,7 +72,7 @@ class Notification(BookWyrmModel):
except Notification.DoesNotExist:
return
notification.related_users.remove(related_user)
if not notification.related_users.exists():
if not notification.related_users.count():
notification.delete()
@ -202,7 +202,7 @@ def notify_admins_on_report(sender, instance, *args, **kwargs):
notification, _ = Notification.objects.get_or_create(
user=admin,
notification_type=Notification.REPORT,
unread=True,
read=False,
)
notification.related_reports.add(instance)