Explicitly pass history into DatasetCollectionManager.create

This commit is contained in:
mvdbeek
2021-10-18 11:42:40 +02:00
parent 53e3cf56c3
commit 00a274c26a
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -201,7 +201,6 @@ class DatasetCollectionManager:
has_subcollections = collection_type_description.has_subcollections()
# If we have elements, this is an internal request, don't need to load
# objects from identifiers.
history = history or trans.history
if elements is None:
elements = self._element_identifiers_to_elements(trans,
collection_type_description=collection_type_description,
@@ -209,7 +208,8 @@ class DatasetCollectionManager:
hide_source_items=hide_source_items,
copy_elements=copy_elements,
history=history)
history.add_pending_items()
if history:
history.add_pending_items()
else:
if has_subcollections:
# Nested collection - recursively create collections as needed.
@@ -42,7 +42,7 @@ class DatasetCollectionsController(
:type payload: dict
:param payload: (optional) dictionary structure containing:
* collection_type: dataset colltion type to create.
* collection_type: dataset collection type to create.
* instance_type: Instance type - 'history' or 'library'.
* name: the new dataset collections's name
* datasets: object describing datasets for collection
@@ -57,6 +57,7 @@ class DatasetCollectionsController(
history_id = decode_id(self.app, history_id)
history = self.history_manager.get_owned(history_id, trans.user, current_history=trans.history)
create_params["parent"] = history
create_params["history"] = history
elif instance_type == "library":
folder_id = payload.get('folder_id')
library_folder = self.get_library_folder(trans, folder_id, check_accessible=True)