Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pass required context for instructor emails #34401

Open
wants to merge 1 commit into
base: open-release/quince.master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lms/djangoapps/instructor/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
EnrollEnrolled,
RemoveBetaTester
)
from openedx.core.djangoapps.ace_common.template_context import get_base_template_context
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming import helpers as theming_helpers
from openedx.core.djangoapps.user_api.models import UserPreference
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order
Expand Down Expand Up @@ -504,6 +506,15 @@ def send_mail_to_student(student, param_dict, language=None):
if 'user_id' in param_dict and param_dict['user_id'] is not None and param_dict['user_id'] > 0:
lms_user_id = param_dict['user_id']

# Get required context
site = theming_helpers.get_current_site()
message_context = get_base_template_context(site)
param_dict['logo_url'] = message_context.get("logo_url")
param_dict['homepage_url'] = message_context.get("homepage_url")
param_dict['dashboard_url'] = message_context.get("dashboard_url")
param_dict['platform_name'] = message_context.get("platform_name")
param_dict['contact_email'] = message_context.get("contact_email")

# see if there is an activation email template definition available as configuration,
# if so, then render that
message_type = param_dict['message_type']
Expand Down
Loading