Merge pull request #609 from mouse-reeve/model-notifications

Refactors generating notifications
This commit is contained in:
Mouse Reeve
2021-02-10 16:45:02 -08:00
committed by GitHub
13 changed files with 132 additions and 121 deletions

View File

@ -35,19 +35,3 @@ def create_generated_note(user, content, mention_books=None, privacy='public'):
status.mention_books.set(mention_books)
status.save(created=True)
return status
def create_notification(user, notification_type, related_user=None, \
related_book=None, related_status=None, related_import=None):
''' let a user know when someone interacts with their content '''
if user == related_user:
# don't create notification when you interact with your own stuff
return
models.Notification.objects.create(
user=user,
related_book=related_book,
related_user=related_user,
related_status=related_status,
related_import=related_import,
notification_type=notification_type,
)