Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
b3f0df73
Commit
b3f0df73
authored
4 years ago
by
Sid Verma
Browse files
Options
Downloads
Patches
Plain Diff
Include common base contexts in user activation email
parent
37ecece8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/student/helpers.py
+5
-2
5 additions, 2 deletions
common/djangoapps/student/helpers.py
common/djangoapps/student/tests/test_tasks.py
+4
-0
4 additions, 0 deletions
common/djangoapps/student/tests/test_tasks.py
with
9 additions
and
2 deletions
common/djangoapps/student/helpers.py
+
5
−
2
View file @
b3f0df73
...
...
@@ -31,6 +31,7 @@ from lms.djangoapps.grades.api import CourseGradeFactory
from
lms.djangoapps.verify_student.models
import
VerificationDeadline
from
lms.djangoapps.verify_student.services
import
IDVerificationService
from
lms.djangoapps.verify_student.utils
import
is_verification_expiring_soon
,
verification_for_datetime
from
openedx.core.djangoapps.ace_common.template_context
import
get_base_template_context
from
openedx.core.djangoapps.certificates.api
import
certificates_viewable_for_course
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
from
openedx.core.djangoapps.theming.helpers
import
get_themes
...
...
@@ -392,7 +393,8 @@ def generate_activation_email_context(user, registration):
user (User): Currently logged-in user
registration (Registration): Registration object for the currently logged-in user
"""
return
{
context
=
get_base_template_context
(
None
)
context
.
update
({
'
name
'
:
user
.
profile
.
name
,
'
key
'
:
registration
.
activation_key
,
'
lms_url
'
:
configuration_helpers
.
get_value
(
'
LMS_ROOT_URL
'
,
settings
.
LMS_ROOT_URL
),
...
...
@@ -401,7 +403,8 @@ def generate_activation_email_context(user, registration):
'
ACTIVATION_EMAIL_SUPPORT_LINK
'
,
settings
.
ACTIVATION_EMAIL_SUPPORT_LINK
)
or
settings
.
SUPPORT_SITE_LINK
,
'
support_email
'
:
configuration_helpers
.
get_value
(
'
CONTACT_EMAIL
'
,
settings
.
CONTACT_EMAIL
),
}
})
return
context
def
create_or_set_user_attribute_created_on_site
(
user
,
site
):
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/student/tests/test_tasks.py
+
4
−
0
View file @
b3f0df73
...
...
@@ -33,6 +33,10 @@ class SendActivationEmailTestCase(TestCase):
"""
Tests that attributes of the message are being filled correctly in compose_activation_email
"""
# Check that variables used by the base template are present in generated context
self
.
assertIn
(
'
platform_name
'
,
self
.
msg
.
context
)
self
.
assertIn
(
'
contact_mailing_address
'
,
self
.
msg
.
context
)
# Verify the presence of the activation-email specific attributes
self
.
assertEqual
(
self
.
msg
.
recipient
.
username
,
self
.
student
.
username
)
self
.
assertEqual
(
self
.
msg
.
recipient
.
email_address
,
self
.
student
.
email
)
self
.
assertEqual
(
self
.
msg
.
context
[
'
routed_user
'
],
self
.
student
.
username
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment