1
0
Fork 0

Merge branch 'main' into tour

- we need to do this because of conflicting migrations
This commit is contained in:
Hugh Rundle 2022-07-17 16:30:45 +10:00
commit 17dc5e7eb1
71 changed files with 7456 additions and 1373 deletions

View file

@ -71,7 +71,9 @@ class Notification(BookWyrmModel):
"""Create a notification"""
if related_user and (not user.local or user == related_user):
return
notification, _ = cls.objects.get_or_create(user=user, **kwargs)
notification = cls.objects.filter(user=user, **kwargs).first()
if not notification:
notification = cls.objects.create(user=user, **kwargs)
if related_user:
notification.related_users.add(related_user)
notification.read = False
@ -298,8 +300,10 @@ def notify_user_on_follow(sender, instance, created, *args, **kwargs):
notification.read = False
notification.save()
else:
# Only group unread follows
Notification.notify(
instance.user_object,
instance.user_subject,
notification_type=Notification.FOLLOW,
read=False,
)