Notification emails #80

Merged
Oleg-Komarov merged 31 commits from notifications into main 2024-04-18 16:11:20 +02:00
2 changed files with 6 additions and 0 deletions
Showing only changes of commit 93472e9799 - Show all commits

View File

@ -101,6 +101,9 @@ def _setup_followers(
@receiver(m2m_changed, sender=Extension.authors.through) @receiver(m2m_changed, sender=Extension.authors.through)
def _update_authors_follow(instance, action, model, reverse, pk_set, **kwargs): def _update_authors_follow(instance, action, model, reverse, pk_set, **kwargs):
if action not in ['post_add', 'post_remove']:
return
if model == Extension and not reverse: if model == Extension and not reverse:
users = [instance] users = [instance]
extensions = Extension.objects.filter(pk__in=pk_set) extensions = Extension.objects.filter(pk__in=pk_set)

View File

@ -48,6 +48,9 @@ def update_moderator_follows(instance, action, model, reverse, pk_set, **kwargs)
The flag=Flag.MODERATOR is used to avoid deleting follow relations that were created in contexts The flag=Flag.MODERATOR is used to avoid deleting follow relations that were created in contexts
other than moderator's duties. other than moderator's duties.
""" """
if action not in ['post_add', 'post_remove']:
return
moderators = Group.objects.get(name='moderators') moderators = Group.objects.get(name='moderators')
extensions = Extension.objects.all() extensions = Extension.objects.all()
users = [] users = []