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
d43f33db
Commit
d43f33db
authored
9 years ago
by
muzaffaryousaf
Browse files
Options
Downloads
Patches
Plain Diff
Properly escape mixed content. text + html.
TNL-4243
parent
6fef5697
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
lms/djangoapps/edxnotes/tests.py
+15
-0
15 additions, 0 deletions
lms/djangoapps/edxnotes/tests.py
lms/templates/edxnotes/edxnotes.html
+3
-2
3 additions, 2 deletions
lms/templates/edxnotes/edxnotes.html
with
18 additions
and
2 deletions
lms/djangoapps/edxnotes/tests.py
+
15
−
0
View file @
d43f33db
...
...
@@ -998,6 +998,21 @@ class EdxNotesViewsTest(ModuleStoreTestCase):
response
=
self
.
client
.
get
(
self
.
notes_page_url
)
self
.
assertContains
(
response
,
'
Highlights and notes you've made in course content
'
)
# pylint: disable=unused-argument
@patch.dict
(
"
django.conf.settings.FEATURES
"
,
{
"
ENABLE_EDXNOTES
"
:
True
})
@patch
(
"
edxnotes.views.get_notes
"
,
return_value
=
{
'
results
'
:
[]})
@patch
(
"
edxnotes.views.get_course_position
"
,
return_value
=
{
'
display_name
'
:
'
Section 1
'
,
'
url
'
:
'
test_url
'
})
def
test_edxnotes_html_tags_should_not_be_escaped
(
self
,
mock_get_notes
,
mock_position
):
"""
Tests that explicit html tags rendered correctly.
"""
enable_edxnotes_for_the_course
(
self
.
course
,
self
.
user
.
id
)
response
=
self
.
client
.
get
(
self
.
notes_page_url
)
self
.
assertContains
(
response
,
'
Get started by making a note in something you just read, like <a href=
"
test_url
"
>Section 1</a>
'
)
@patch.dict
(
"
django.conf.settings.FEATURES
"
,
{
"
ENABLE_EDXNOTES
"
:
False
})
def
test_edxnotes_view_is_disabled
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
lms/templates/edxnotes/edxnotes.html
+
3
−
2
View file @
d43f33db
...
...
@@ -5,6 +5,7 @@
<
%!
from
django.utils.translation
import
ugettext
as
_
from
edxnotes.helpers
import
NoteJSONEncoder
from
openedx.core.djangolib.markup
import
Text
,
HTML
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
,
js_escaped_string
%
>
...
...
@@ -78,8 +79,8 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str
% if position is not None:
<div
class=
"placeholder-cta student-notes-cta"
>
<p
class=
"placeholder-cta-copy"
>
${_('Get started by making a note in something you just read, like {section_link}.').format(
section_link='
<a
href=
"{url}"
>
{section_name}
</a>
'.format(
<p
class=
"placeholder-cta-copy"
>
${
Text(
_('Get started by making a note in something you just read, like {section_link}.')
)
.format(
section_link=
HTML(
'
<a
href=
"{url}"
>
{section_name}
</a>
'
)
.format(
url=position['url'],
section_name=position['display_name'],
)
...
...
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