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
5e1f03bb
Commit
5e1f03bb
authored
Oct 02, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish removes deleted children
parent
18c45879
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+14
-0
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
5e1f03bb
...
...
@@ -234,12 +234,26 @@ class DraftModuleStore(MongoModuleStore):
"""
Save a current draft to the underlying modulestore
"""
try
:
original_published
=
super
(
DraftModuleStore
,
self
)
.
get_item
(
location
)
except
ItemNotFoundError
:
original_published
=
None
draft
=
self
.
get_item
(
location
)
draft
.
published_date
=
datetime
.
now
(
UTC
)
draft
.
published_by
=
published_by_id
super
(
DraftModuleStore
,
self
)
.
update_item
(
location
,
draft
.
get_explicitly_set_fields_by_scope
(
Scope
.
content
))
if
draft
.
has_children
:
if
original_published
is
not
None
:
# see if children were deleted. 2 reasons for children lists to differ:
# 1) child deleted
# 2) child moved
for
child
in
original_published
.
children
:
if
child
not
in
draft
.
children
:
rents
=
[
Location
(
mom
)
for
mom
in
self
.
get_parent_locations
(
child
,
None
)]
if
(
len
(
rents
)
==
1
and
rents
[
0
]
==
Location
(
location
)):
# the 1 is this original_published
self
.
delete_item
(
child
,
True
)
super
(
DraftModuleStore
,
self
)
.
update_children
(
location
,
draft
.
children
)
super
(
DraftModuleStore
,
self
)
.
update_metadata
(
location
,
own_metadata
(
draft
))
self
.
delete_item
(
location
)
...
...
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