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
f3b33ef1
Commit
f3b33ef1
authored
May 02, 2016
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12275 from edx/ormsbee/video_state_opt_2
Remove unnecessary VideoModule save_states.
parents
dde18c7e
f9d85e65
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
5 deletions
+45
-5
common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js
+29
-3
common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js
+6
-1
common/lib/xmodule/xmodule/video_module/video_module.py
+6
-1
lms/djangoapps/courseware/tests/test_video_mongo.py
+4
-0
No files found.
common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js
View file @
f3b33ef1
...
...
@@ -9,12 +9,14 @@
.
createSpy
(
'onTouchBasedDevice'
)
.
and
.
returnValue
(
null
);
state
=
jasmine
.
initializePlayer
();
state
=
jasmine
.
initializePlayer
({
recordedYoutubeIsAvailable
:
true
});
spyOn
(
state
.
storage
,
'setItem'
);
});
afterEach
(
function
()
{
$
(
'source'
).
remove
();
window
.
onTouchBasedDevice
=
oldOTBD
;
state
.
storage
.
clear
();
...
...
@@ -199,7 +201,20 @@
expect
(
state
.
storage
.
setItem
).
toHaveBeenCalledWith
(
'language'
,
'ua'
);
});
it
(
'can save information about youtube availability'
,
function
()
{
it
(
'can save youtube availability'
,
function
()
{
$
.
ajax
.
calls
.
reset
();
// Test the cases where we shouldn't send anything at all -- client
// side code determines that YouTube availability is the same as
// what's already been recorded on the server side.
state
.
config
.
recordedYoutubeIsAvailable
=
true
;
state
.
el
.
trigger
(
'youtube_availability'
,
[
true
]);
state
.
config
.
recordedYoutubeIsAvailable
=
false
;
state
.
el
.
trigger
(
'youtube_availability'
,
[
false
]);
expect
(
$
.
ajax
).
not
.
toHaveBeenCalled
();
// Test that we can go from unavailable -> available
state
.
config
.
recordedYoutubeIsAvailable
=
false
;
state
.
el
.
trigger
(
'youtube_availability'
,
[
true
]);
expect
(
$
.
ajax
).
toHaveBeenCalledWith
({
url
:
state
.
config
.
saveStateUrl
,
...
...
@@ -208,6 +223,17 @@
dataType
:
'json'
,
data
:
{
youtube_is_available
:
true
}
});
// Test that we can go from available -> unavailable
state
.
config
.
recordedYoutubeIsAvailable
=
true
;
state
.
el
.
trigger
(
'youtube_availability'
,
[
false
]);
expect
(
$
.
ajax
).
toHaveBeenCalledWith
({
url
:
state
.
config
.
saveStateUrl
,
type
:
'POST'
,
async
:
true
,
dataType
:
'json'
,
data
:
{
youtube_is_available
:
false
}
});
});
it
(
'can destroy itself'
,
function
()
{
...
...
common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js
View file @
f3b33ef1
...
...
@@ -84,7 +84,12 @@ define('video/09_save_state_plugin.js', [], function() {
},
onYoutubeAvailability
:
function
(
event
,
youtubeIsAvailable
)
{
this
.
saveState
(
true
,
{
youtube_is_available
:
youtubeIsAvailable
});
// Compare what the client-side code has determined Youtube
// availability to be (true/false) vs. what the LMS recorded for
// this user. The LMS will assume YouTube is available by default.
if
(
youtubeIsAvailable
!==
this
.
state
.
config
.
recordedYoutubeIsAvailable
)
{
this
.
saveState
(
true
,
{
youtube_is_available
:
youtubeIsAvailable
});
}
},
saveState
:
function
(
async
,
data
)
{
...
...
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
f3b33ef1
...
...
@@ -332,7 +332,12 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
## There is no option in the "Advanced Editor" to set this option. However,
## this option will have an effect if changed to "True". The code on
## front-end exists.
'autohideHtml5'
:
False
'autohideHtml5'
:
False
,
# This is the server's guess at whether youtube is available for
# this user, based on what was recorded the last time we saw the
# user, and defaulting to True.
'recordedYoutubeIsAvailable'
:
self
.
youtube_is_available
,
}
bumperize
(
self
)
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
f3b33ef1
...
...
@@ -79,6 +79,7 @@ class TestVideoYouTube(TestVideo):
self
.
item_descriptor
,
'transcript'
,
'available_translations'
)
.
rstrip
(
'/?'
),
"autohideHtml5"
:
False
,
"recordedYoutubeIsAvailable"
:
True
,
})),
'track'
:
None
,
'transcript_download_format'
:
'srt'
,
...
...
@@ -157,6 +158,7 @@ class TestVideoNonYouTube(TestVideo):
self
.
item_descriptor
,
'transcript'
,
'available_translations'
)
.
rstrip
(
'/?'
),
"autohideHtml5"
:
False
,
"recordedYoutubeIsAvailable"
:
True
,
})),
'track'
:
None
,
'transcript_download_format'
:
'srt'
,
...
...
@@ -211,6 +213,7 @@ class TestGetHtmlMethod(BaseTestXmodule):
self
.
item_descriptor
,
'transcript'
,
'available_translations'
)
.
rstrip
(
'/?'
),
"autohideHtml5"
:
False
,
"recordedYoutubeIsAvailable"
:
True
,
})
def
test_get_html_track
(
self
):
...
...
@@ -1379,6 +1382,7 @@ class TestVideoWithBumper(TestVideo):
self
.
item_descriptor
,
'transcript'
,
'available_translations'
)
.
rstrip
(
'/?'
),
"autohideHtml5"
:
False
,
"recordedYoutubeIsAvailable"
:
True
,
})),
'track'
:
None
,
'transcript_download_format'
:
'srt'
,
...
...
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