Merge pull request #7621 from edx/shr/bug/TNL-1858-Unable-to-delete-studio-page

Delete static_tab for split courses raises 500 error
This commit is contained in:
Shrhawk
2015-05-08 15:06:03 +05:00
2 changed files with 11 additions and 4 deletions

View File

@@ -213,7 +213,11 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
parent_loc = self.get_parent_location(branched_location)
SplitMongoModuleStore.delete_item(self, branched_location, user_id)
# publish parent w/o child if deleted element is direct only (not based on type of parent)
if branch == ModuleStoreEnum.BranchName.draft and branched_location.block_type in DIRECT_ONLY_CATEGORIES:
if (
branch == ModuleStoreEnum.BranchName.draft and
branched_location.block_type in DIRECT_ONLY_CATEGORIES and parent_loc
):
# will publish if its not an orphan
self.publish(parent_loc.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs)
def _map_revision_to_branch(self, key, revision=None):