notify orga of new added talks
This commit is contained in:
parent
fa659ee595
commit
7411d660d8
|
@ -1,6 +1,7 @@
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
from accounts.models import Participation
|
from accounts.models import Participation
|
||||||
from proposals.models import Talk
|
from proposals.models import Talk
|
||||||
|
@ -26,9 +27,10 @@ def create_conversation_about_talk(sender, instance, created, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def check_talk(talk):
|
def check_talk(talk):
|
||||||
# Subscribe reviewer for these topics to conversations
|
reviewers = User.objects.filter(Q(topic__talk=talk) | Q(participation__site=talk.site, participation__orga=True))
|
||||||
reviewers = User.objects.filter(topic__talk=talk)
|
# Subscribe the reviewers to the conversation about the talk
|
||||||
talk.conversation.subscribers.add(*reviewers)
|
talk.conversation.subscribers.add(*reviewers)
|
||||||
|
# Subscribe the reviewers to the conversations with each speaker
|
||||||
for user in talk.speakers.all():
|
for user in talk.speakers.all():
|
||||||
participation, created = Participation.objects.get_or_create(user=user, site=talk.site)
|
participation, created = Participation.objects.get_or_create(user=user, site=talk.site)
|
||||||
participation.conversation.subscribers.add(*reviewers)
|
participation.conversation.subscribers.add(*reviewers)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user