diff --git a/bookwyrm/models/antispam.py b/bookwyrm/models/antispam.py index 855ba9a38..dd2a6df26 100644 --- a/bookwyrm/models/antispam.py +++ b/bookwyrm/models/antispam.py @@ -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) diff --git a/bookwyrm/models/notification.py b/bookwyrm/models/notification.py index 745a95342..a11d53f85 100644 --- a/bookwyrm/models/notification.py +++ b/bookwyrm/models/notification.py @@ -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)