diff --git a/bookwyrm/tests/models/test_notification.py b/bookwyrm/tests/models/test_notification.py index 3d6025a5f..0e4fe91c7 100644 --- a/bookwyrm/tests/models/test_notification.py +++ b/bookwyrm/tests/models/test_notification.py @@ -76,6 +76,17 @@ class Notification(TestCase): notification.refresh_from_db() self.assertEqual(notification.related_users.count(), 2) + def test_notify_grouping_with_dupes(self): + """If there are multiple options to group with, don't cause an error""" + models.Notification.objects.create( + user=self.local_user, notification_type="FAVORITE" + ) + models.Notification.objects.create( + user=self.local_user, notification_type="FAVORITE" + ) + models.Notification.notify(self.local_user, None, notification_type="FAVORITE") + self.assertEqual(models.Notification.objects.count(), 2) + def test_notify_remote(self): """Don't create notifications for remote users""" models.Notification.notify( diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 3f07345c8..0090cbe32 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -15,7 +15,7 @@ from .helpers import ( handle_remote_webfinger, subscribe_remote_webfinger, WebFingerError, - is_api_request + is_api_request, )