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
51fc7b73
Commit
51fc7b73
authored
7 years ago
by
Diana Huang
Committed by
GitHub
7 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15457 from edx/diana/replace-updates-urls
Replace urls in html updates.
parents
ea7b14eb
378b1f86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
openedx/features/course_experience/views/course_updates.py
+5
-1
openedx/features/course_experience/views/welcome_message.py
+1
-3
No files found.
openedx/features/course_experience/views/course_updates.py
View file @
51fc7b73
...
@@ -79,11 +79,14 @@ class CourseUpdatesFragmentView(EdxFragmentView):
...
@@ -79,11 +79,14 @@ class CourseUpdatesFragmentView(EdxFragmentView):
info_module
=
get_course_info_section_module
(
request
,
request
.
user
,
course
,
'updates'
)
info_module
=
get_course_info_section_module
(
request
,
request
.
user
,
course
,
'updates'
)
updates
=
info_module
.
items
if
info_module
else
[]
updates
=
info_module
.
items
if
info_module
else
[]
info_block
=
getattr
(
info_module
,
'_xmodule'
,
info_module
)
if
info_module
else
None
ordered_updates
=
[
update
for
update
in
updates
if
update
.
get
(
'status'
)
==
self
.
STATUS_VISIBLE
]
ordered_updates
=
[
update
for
update
in
updates
if
update
.
get
(
'status'
)
==
self
.
STATUS_VISIBLE
]
ordered_updates
.
sort
(
ordered_updates
.
sort
(
key
=
lambda
item
:
(
self
.
safe_parse_date
(
item
[
'date'
]),
item
[
'id'
]),
key
=
lambda
item
:
(
self
.
safe_parse_date
(
item
[
'date'
]),
item
[
'id'
]),
reverse
=
True
reverse
=
True
)
)
for
update
in
ordered_updates
:
update
[
'content'
]
=
info_block
.
system
.
replace_urls
(
update
[
'content'
])
return
ordered_updates
return
ordered_updates
@classmethod
@classmethod
...
@@ -98,7 +101,8 @@ class CourseUpdatesFragmentView(EdxFragmentView):
...
@@ -98,7 +101,8 @@ class CourseUpdatesFragmentView(EdxFragmentView):
a single html object representing all the updates.
a single html object representing all the updates.
"""
"""
info_module
=
get_course_info_section_module
(
request
,
request
.
user
,
course
,
'updates'
)
info_module
=
get_course_info_section_module
(
request
,
request
.
user
,
course
,
'updates'
)
return
info_module
.
data
if
info_module
else
''
info_block
=
getattr
(
info_module
,
'_xmodule'
,
info_module
)
return
info_block
.
system
.
replace_urls
(
info_module
.
data
)
if
info_module
else
''
@staticmethod
@staticmethod
def
safe_parse_date
(
date
):
def
safe_parse_date
(
date
):
...
...
This diff is collapsed.
Click to expand it.
openedx/features/course_experience/views/welcome_message.py
View file @
51fc7b73
...
@@ -57,9 +57,7 @@ class WelcomeMessageFragmentView(EdxFragmentView):
...
@@ -57,9 +57,7 @@ class WelcomeMessageFragmentView(EdxFragmentView):
ordered_updates
=
CourseUpdatesFragmentView
.
get_ordered_updates
(
request
,
course
)
ordered_updates
=
CourseUpdatesFragmentView
.
get_ordered_updates
(
request
,
course
)
content
=
None
content
=
None
if
ordered_updates
:
if
ordered_updates
:
info_module
=
get_course_info_section_module
(
request
,
request
.
user
,
course
,
'updates'
)
content
=
ordered_updates
[
0
][
'content'
]
info_block
=
getattr
(
info_module
,
'_xmodule'
,
info_module
)
content
=
info_block
.
system
.
replace_urls
(
ordered_updates
[
0
][
'content'
])
return
content
return
content
...
...
This diff is collapsed.
Click to expand it.
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