(self, active_flag, rule)
return JsonResponse({
            'status': 'success',
            'rule': self._format_rule_for_json(rule),
        })
When we deactivate a conditional alert from the UI, we are only
        deactivating the schedule that sends the content. The rule itself
        stays active.
        This is because we want to be keeping all the schedule instances
        up to date (though inactive), so that if the schedule is reactivated,
        we don't send a large quantity of stale messages.
When we deactivate a conditional alert from the UI, we are only
        deactivating the schedule that sends the content. The rule itself
        stays active.
        This is because we want to be keeping all the schedule instances
        up to date (though inactive), so that if the schedule is reactivated,
        we don't send a large quantity of stale messages.
When we deactivate a conditional alert from the UI we are only deactivating the schedule that sends the content . The rule itself stays active . This is because we want to be keeping all the schedule instances up to date ( though inactive ) so that if the schedule is reactivated we don t send a large quantity of stale messages .
def get_activate_ajax_response(self, active_flag, rule):
        """
        When we deactivate a conditional alert from the UI, we are only
        deactivating the schedule that sends the content. The rule itself
        stays active.
        This is because we want to be keeping all the schedule instances
        up to date (though inactive), so that if the schedule is reactivated,
        we don't send a large quantity of stale messages.
        """
        with transaction.atomic():
            schedule = rule.get_schedule()
            if active_flag and not self.can_use_inbound_sms and schedule.memoized_uses_sms_survey:
                return HttpResponseBadRequest(
                    "Cannot create or edit survey reminders because subscription "
                    "does not have access to inbound SMS"
                )

            if active_flag and (rule.references_parent_case or schedule.references_parent_case):
                return HttpResponseBadRequest(
                    "Cannot reactivate alerts that reference parent case properties"
                )

            if active_flag and (schedule.memoized_uses_ivr_survey or schedule.memoized_uses_sms_callback):
                return HttpResponseBadRequest(
                    "Cannot activate alerts which use IVR or SMS Callback use cases since they "
                    "are no longer supported."
                )

            schedule.active = active_flag
            schedule.save()
            initiate_messaging_rule_run(rule)

        return JsonResponse({
            'status': 'success',
            'rule': self._format_rule_for_json(rule),
        })
def get_activate_ajax_response ( self , active_flag , rule ) : with transaction . atomic ( ) : schedule = rule . get_schedule ( ) if active_flag and not self . can_use_inbound_sms and schedule . memoized_uses_sms_survey : return HttpResponseBadRequest ( "Cannot create or edit survey reminders because subscription " "does not have access to inbound SMS" ) if active_flag and ( rule . references_parent_case or schedule . references_parent_case ) : return HttpResponseBadRequest ( "Cannot reactivate alerts that reference parent case properties" ) if active_flag and ( schedule . memoized_uses_ivr_survey or schedule . memoized_uses_sms_callback ) : return HttpResponseBadRequest ( "Cannot activate alerts which use IVR or SMS Callback use cases since they " "are no longer supported." ) schedule . active = active_flag schedule . save ( ) initiate_messaging_rule_run ( rule ) return JsonResponse ( { 'status' : 'success' , 'rule' : self . _format_rule_for_json ( rule ) , } )