Updates group leave and remove notifications
This commit is contained in:
parent
c65381adf9
commit
736d29ea20
5 changed files with 28 additions and 21 deletions
|
@ -57,10 +57,11 @@ class Notification(BookWyrmModel):
|
|||
@transaction.atomic
|
||||
def notify(cls, user, related_user, **kwargs):
|
||||
"""Create a notification"""
|
||||
if not user.local or user == related_user:
|
||||
if related_user and (not user.local or user == related_user):
|
||||
return
|
||||
notification, _ = cls.objects.get_or_create(user=user, **kwargs)
|
||||
notification.related_users.add(related_user)
|
||||
if related_user:
|
||||
notification.related_users.add(related_user)
|
||||
notification.read = False
|
||||
notification.save()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue