Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6f326f72
Commit
6f326f72
authored
May 17, 2017
by
Diana Huang
Committed by
GitHub
May 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15136 from edx/diana/replace-welcome-message-urls
Replace urls in the welcome message.
parents
aa4eba33
9ecbc9bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
openedx/features/course_experience/tests/views/test_welcome_message.py
+10
-0
openedx/features/course_experience/views/welcome_message.py
+5
-1
No files found.
openedx/features/course_experience/tests/views/test_welcome_message.py
View file @
6f326f72
...
...
@@ -67,6 +67,16 @@ class TestWelcomeMessageView(SharedModuleStoreTestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'Second Update'
)
def
test_replace_urls
(
self
):
img_url
=
'img.png'
create_course_update
(
self
.
course
,
self
.
user
,
"<img src='/static/{url}'>"
.
format
(
url
=
img_url
))
response
=
self
.
client
.
get
(
welcome_message_url
(
self
.
course
))
self
.
assertContains
(
response
,
"/asset-v1:{org}+{course}+{run}+type@asset+block/img.png"
.
format
(
org
=
self
.
course
.
id
.
org
,
course
=
self
.
course
.
id
.
course
,
run
=
self
.
course
.
id
.
run
))
def
test_empty_welcome_message
(
self
):
response
=
self
.
client
.
get
(
welcome_message_url
(
self
.
course
))
self
.
assertEqual
(
response
.
status_code
,
204
)
openedx/features/course_experience/views/welcome_message.py
View file @
6f326f72
...
...
@@ -45,4 +45,8 @@ class WelcomeMessageFragmentView(EdxFragmentView):
# Return the course update with the most recent publish date
info_block
=
getattr
(
info_module
,
'_xmodule'
,
info_module
)
ordered_updates
=
info_block
.
ordered_updates
()
return
ordered_updates
[
0
][
'content'
]
if
ordered_updates
else
None
content
=
None
if
ordered_updates
:
content
=
info_block
.
system
.
replace_urls
(
ordered_updates
[
0
][
'content'
])
return
content
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment