Skip to content

Commit

Permalink
Fix new edge case where all items might be already deleted
Browse files Browse the repository at this point in the history
This case was previously prevented at the UI level but should be considered here.
  • Loading branch information
davelopez committed Feb 7, 2024
1 parent bc0b3eb commit f60f0ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/galaxy/webapps/galaxy/services/history_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,8 +1417,12 @@ def _unhide(self, item: HistoryItemModel):

def _delete(self, item: HistoryItemModel, trans: ProvidesHistoryContext):
if isinstance(item, HistoryDatasetCollectionAssociation):
return self.dataset_collection_manager.delete(trans, "history", item.id, recursive=True, purge=False)
return self.hda_manager.delete(item, flush=self.flush)
self.dataset_collection_manager.delete(trans, "history", item.id, recursive=True, purge=False)
else:
self.hda_manager.delete(item, flush=self.flush)
# In the edge case where all selected items are already deleted we need to force an update
# otherwise the history will wait indefinitely for the items to be deleted
item.update()

def _undelete(self, item: HistoryItemModel):
if getattr(item, "purged", False):
Expand Down

0 comments on commit f60f0ae

Please sign in to comment.