From c32b87d65f4b42efe937182163df288fd481228a Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:26:42 +0100 Subject: [PATCH] Fix filtering archived histories --- lib/galaxy/managers/histories.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/galaxy/managers/histories.py b/lib/galaxy/managers/histories.py index 9f5140c39aa..d3672fb7500 100644 --- a/lib/galaxy/managers/histories.py +++ b/lib/galaxy/managers/histories.py @@ -207,6 +207,17 @@ class HistoryManager(sharable.SharableModelManager, deletable.PurgableManagerMix self.model_class.deleted == (true() if show_deleted else false()) ) + # Handle archived histories + if show_published: + # Someone published a history and then archived it, it should still be returned + stmt = stmt.where(or_(self.model_class.archived == false(), self.model_class.published == true())) + elif show_shared: + # Someone shared a history with the current user and then archived it, it should still be returned + stmt = stmt.where(or_(self.model_class.archived == false(), self.user_share_model.user == user)) + else: + # By default, only return non-archived histories + stmt = stmt.where(self.model_class.archived == false()) + stmt = stmt.distinct() if include_total_count: