def update(self, request, *args, **kwargs): user = self.get_object() if user.is_verified: send_fxa_mail.delay([user.pk], 'customers-during', True) return Response({'notified': True}) else: return Response({'notified': False})
def handle(self, *args, **kwargs): mail_type = kwargs.get('type') if mail_type not in fxa_email_types: raise ValueError('{0} email not known.'.format(mail_type)) audience, phase = mail_type.split('-') is_live = phase in ['during', 'after'] is_developers = audience == 'developers' all_ids = get_user_ids(is_developers) log.info('Sending: {0} {1} emails'.format(len(all_ids), mail_type)) for chunked_ids in chunked(all_ids, 100): send_fxa_mail.delay(chunked_ids, mail_type, is_live)