diff --git a/src/program/models.py b/src/program/models.py index b395ef20..cafef3f6 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -11,6 +11,7 @@ from django.contrib import messages from django.db import models from django.dispatch import receiver from django.utils.text import slugify +from django.utils import timezone from django.conf import settings from django.core.exceptions import ValidationError from django.core.urlresolvers import reverse_lazy @@ -22,6 +23,7 @@ from django.db.models.signals import post_save from utils.models import CreatedUpdatedModel, CampRelatedModel from .email import add_new_speakerproposal_email, add_new_eventproposal_email +from ircbot.models import OutgoingIrcMessage logger = logging.getLogger("bornhack.%s" % __name__) @@ -275,18 +277,36 @@ class EventProposal(UserSubmittedModel): @receiver(post_save, sender=EventProposal) @receiver(post_save, sender=SpeakerProposal) -def notify_content_team(sender, created, instance, **kwargs): +def notify_proposals(sender, created, instance, **kwargs): + target = settings.IRCBOT_CHANNELS['orga'] if 'orga' in settings.IRCBOT_CHANNELS else settings.IRCBOT_CHANNELS['default'] + if created and isinstance(instance, SpeakerProposal): if not add_new_speakerproposal_email(instance): logger.error( 'Error adding speaker proposal email to outgoing queue for {}'.format(instance) ) + OutgoingIrcMessage.objects.create( + target=target, + message="New speaker proposal: {} (https://bornhack.dk/admin/program/speakerproposal/{}/change/)".format( + instance.name, + instance.uuid + ), + timeout=timezone.now()+timedelta(minutes=10) + ) if created and isinstance(instance, EventProposal): if not add_new_eventproposal_email(instance): logger.error( 'Error adding event proposal email to outgoing queue for {}'.format(instance) ) + OutgoingIrcMessage.objects.create( + target=target, + message="New event proposal: {} (https://bornhack.dk/admin/program/eventproposal/{{ proposal.uuid }}/change/)".format( + instance.title, + instance.uuid + ), + timeout=timezone.now()+timedelta(minutes=10) + ) ###############################################################################