mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Fixes get_or_create error when multiple matching notifications exist
This commit is contained in:
parent
c092d952bd
commit
f92b4548b1
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue