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
5e1f03bb
Commit
5e1f03bb
authored
11 years ago
by
Don Mitchell
Browse files
Options
Downloads
Patches
Plain Diff
Publish removes deleted children
parent
18c45879
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+14
-0
14 additions, 0 deletions
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
with
14 additions
and
0 deletions
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+
14
−
0
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
)
...
...
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