diff --git a/lib/galaxy/managers/histories.py b/lib/galaxy/managers/histories.py index 5c0b62e1a08a..99a7c70d80ff 100644 --- a/lib/galaxy/managers/histories.py +++ b/lib/galaxy/managers/histories.py @@ -18,6 +18,7 @@ from sqlalchemy import ( asc, desc, + exists, false, func, select, @@ -340,13 +341,12 @@ def get_sharing_extra_information( return extra def is_history_shared_with(self, history: model.History, user: model.User) -> bool: - stmt = ( - select(HistoryUserShareAssociation.id) + stmt = select( + exists() .where(HistoryUserShareAssociation.user_id == user.id) .where(HistoryUserShareAssociation.history_id == history.id) - .limit(1) ) - return bool(self.session().execute(stmt).first()) + return self.session().scalar(stmt) def make_members_public(self, trans, item): """Make the non-purged datasets in history public.