diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index f66e71a0740f..b06cac7b7e50 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -62,6 +62,7 @@ ) from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser +from openedx.features.discounts.applicability import FIRST_PURCHASE_DISCOUNT_OVERRIDE_FLAG from openedx.features.enterprise_support.utils import is_enterprise_learner from common.djangoapps.student.email_helpers import generate_activation_email_context from common.djangoapps.student.helpers import DISABLE_UNENROLL_CERT_STATES, cert_info @@ -206,12 +207,13 @@ def compose_activation_email( message_context = generate_activation_email_context(user, user_registration) message_context.update({ 'confirm_activation_link': _get_activation_confirmation_link(message_context['key'], redirect_url), + 'is_enterprise_learner': is_enterprise_learner(user), + 'is_first_purchase_discount_overridden': FIRST_PURCHASE_DISCOUNT_OVERRIDE_FLAG.is_enabled(), 'route_enabled': route_enabled, 'routed_user': user.username, 'routed_user_email': user.email, 'routed_profile_name': profile_name, 'registration_flow': registration_flow, - 'is_enterprise_learner': is_enterprise_learner(user), 'show_auto_generated_username': show_auto_generated_username(user.username), }) diff --git a/openedx/core/djangoapps/user_authn/tests/test_tasks.py b/openedx/core/djangoapps/user_authn/tests/test_tasks.py index 80516f20a39c..5103343a0879 100644 --- a/openedx/core/djangoapps/user_authn/tests/test_tasks.py +++ b/openedx/core/djangoapps/user_authn/tests/test_tasks.py @@ -19,6 +19,7 @@ class SendActivationEmailTestCase(TestCase): """ Test for send activation email to user """ + def setUp(self): """ Setup components used by each test.""" super().setUp() @@ -44,6 +45,7 @@ def test_ComposeEmail(self): assert self.msg.context['routed_profile_name'] == '' assert self.msg.context['registration_flow'] is False assert self.msg.context['is_enterprise_learner'] is False + assert self.msg.context['is_first_purchase_discount_overridden'] is False @mock.patch('time.sleep', mock.Mock(return_value=None)) @mock.patch('openedx.core.djangoapps.user_authn.tasks.log') diff --git a/openedx/features/discounts/applicability.py b/openedx/features/discounts/applicability.py index 2a9bc34c2dc0..97d6f74403bd 100644 --- a/openedx/features/discounts/applicability.py +++ b/openedx/features/discounts/applicability.py @@ -32,7 +32,7 @@ # .. toggle_name: discounts.enable_first_purchase_discount_override # .. toggle_implementation: WaffleFlag # .. toggle_default: False -# .. toggle_description: Waffle flag to enable the First Purchase Discount to be overriden from +# .. toggle_description: Waffle flag to enable the First Purchase Discount to be overridden from # EDXWELCOME/BIENVENIDOAEDX 15% discount to a new code. # .. toggle_use_cases: opt_in # .. toggle_creation_date: 2024-07-18