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
ab60b110
Commit
ab60b110
authored
Jul 08, 2015
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8735 from edx/mushtaq/plat633-delete-case
Fix 'stuck in publish issue' when deleting a component
parents
d07a2798
2ca9d4d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+2
-0
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+43
-0
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
ab60b110
...
@@ -2397,6 +2397,8 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
...
@@ -2397,6 +2397,8 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
parent_block
.
edit_info
.
edited_by
=
user_id
parent_block
.
edit_info
.
edited_by
=
user_id
parent_block
.
edit_info
.
previous_version
=
parent_block
.
edit_info
.
update_version
parent_block
.
edit_info
.
previous_version
=
parent_block
.
edit_info
.
update_version
parent_block
.
edit_info
.
update_version
=
new_id
parent_block
.
edit_info
.
update_version
=
new_id
# remove the source_version reference
parent_block
.
edit_info
.
source_version
=
None
self
.
decache_block
(
usage_locator
.
course_key
,
new_id
,
parent_block_key
)
self
.
decache_block
(
usage_locator
.
course_key
,
new_id
,
parent_block_key
)
self
.
_remove_subtree
(
BlockKey
.
from_usage_key
(
usage_locator
),
new_blocks
)
self
.
_remove_subtree
(
BlockKey
.
from_usage_key
(
usage_locator
),
new_blocks
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
ab60b110
...
@@ -592,6 +592,49 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
...
@@ -592,6 +592,49 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# Verify that changes are present
# Verify that changes are present
self
.
assertTrue
(
self
.
store
.
has_changes
(
component
))
self
.
assertTrue
(
self
.
store
.
has_changes
(
component
))
@ddt.data
(
'draft'
,
'split'
)
def
test_unit_stuck_in_published_mode_after_delete
(
self
,
default_ms
):
"""
Test that a unit does not get stuck in published mode
after discarding a component changes and deleting a component
"""
self
.
initdb
(
default_ms
)
test_course
=
self
.
store
.
create_course
(
'testx'
,
'GreekHero'
,
'test_run'
,
self
.
user_id
)
# Create a dummy vertical & html component to test against
vertical
=
self
.
store
.
create_item
(
self
.
user_id
,
test_course
.
id
,
'vertical'
,
block_id
=
'test_vertical'
)
component
=
self
.
store
.
create_child
(
self
.
user_id
,
vertical
.
location
,
'html'
,
block_id
=
'html_component'
)
# publish vertical changes
self
.
store
.
publish
(
vertical
.
location
,
self
.
user_id
)
self
.
assertFalse
(
self
.
_has_changes
(
vertical
.
location
))
# Change a component, then check that there now are changes
component
=
self
.
store
.
get_item
(
component
.
location
)
component
.
display_name
=
'Changed Display Name'
self
.
store
.
update_item
(
component
,
self
.
user_id
)
self
.
assertTrue
(
self
.
_has_changes
(
vertical
.
location
))
# Discard changes and verify that there are no changes
self
.
store
.
revert_to_published
(
vertical
.
location
,
self
.
user_id
)
self
.
assertFalse
(
self
.
_has_changes
(
vertical
.
location
))
# Delete the component and verify that the unit has changes
self
.
store
.
delete_item
(
component
.
location
,
self
.
user_id
)
vertical
=
self
.
store
.
get_item
(
vertical
.
location
)
self
.
assertTrue
(
self
.
_has_changes
(
vertical
.
location
))
def
setup_has_changes
(
self
,
default_ms
):
def
setup_has_changes
(
self
,
default_ms
):
"""
"""
Common set up for has_changes tests below.
Common set up for has_changes tests below.
...
...
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