Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
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
f09e9fdc
Unverified
Commit
f09e9fdc
authored
5 years ago
by
Dave St.Germain
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #23004 from edx/dcs/sequence-bookmark
Include bookmark info in sequence metadata.
parents
247cffa8
5528adcc
No related branches found
Branches containing commit
Tags
release-2020-02-03-16.05
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/seq_module.py
+4
-3
4 additions, 3 deletions
common/lib/xmodule/xmodule/seq_module.py
common/lib/xmodule/xmodule/tests/test_sequence.py
+3
-0
3 additions, 0 deletions
common/lib/xmodule/xmodule/tests/test_sequence.py
with
7 additions
and
3 deletions
common/lib/xmodule/xmodule/seq_module.py
+
4
−
3
View file @
f09e9fdc
...
...
@@ -21,6 +21,7 @@ from six import text_type
from
web_fragments.fragment
import
Fragment
from
xblock.completable
import
XBlockCompletionMode
from
xblock.core
import
XBlock
from
xblock.exceptions
import
NoSuchServiceError
from
xblock.fields
import
Boolean
,
Integer
,
List
,
Scope
,
String
from
.exceptions
import
NotFoundError
...
...
@@ -503,9 +504,9 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
render_items
=
not
context
.
get
(
'
exclude_units
'
,
False
)
is_user_authenticated
=
self
.
is_user_authenticated
(
context
)
completion_service
=
self
.
runtime
.
service
(
self
,
'
completion
'
)
if
render_items
:
try
:
bookmarks_service
=
self
.
runtime
.
service
(
self
,
'
bookmarks
'
)
e
lse
:
e
xcept
NoSuchServiceError
:
bookmarks_service
=
None
context
[
'
username
'
]
=
self
.
runtime
.
service
(
self
,
'
user
'
).
get_current_user
().
opt_attrs
.
get
(
'
edx-platform.username
'
)
...
...
@@ -529,7 +530,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
show_bookmark_button
=
False
is_bookmarked
=
False
if
is_user_authenticated
and
render_items
:
if
is_user_authenticated
and
bookmarks_service
:
show_bookmark_button
=
True
is_bookmarked
=
bookmarks_service
.
is_bookmarked
(
usage_key
=
usage_id
)
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/tests/test_sequence.py
+
3
−
0
View file @
f09e9fdc
...
...
@@ -348,6 +348,9 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
Test that the sequence metadata is returned from the
metadata ajax handler.
"""
# rather than dealing with json serialization of the Mock object,
# let's just disable the bookmarks service
self
.
sequence_3_1
.
xmodule_runtime
.
_services
[
'
bookmarks
'
]
=
None
metadata
=
json
.
loads
(
self
.
sequence_3_1
.
handle_ajax
(
'
metadata
'
,
{}))
self
.
assertEqual
(
len
(
metadata
[
'
items
'
]),
3
)
self
.
assertEqual
(
metadata
[
'
tag
'
],
'
sequential
'
)
...
...
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