1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/fb6a06ce35f0/ Changeset: fb6a06ce35f0 User: carlfeberhard Date: 2014-08-13 21:24:21 Summary: Core, histories: when deleting/purging the current history, set the most recent history as the new current. If the user is anonymous or there are no non-deleted histories remaining: create a new, blank history Affected #: 2 files diff -r 898a172941b10e435a6616c8cc04ccec6c7984d3 -r fb6a06ce35f08f516b8a5d80d2105225c243201b lib/galaxy/managers/histories.py --- a/lib/galaxy/managers/histories.py +++ b/lib/galaxy/managers/histories.py @@ -221,6 +221,19 @@ return history_dict + def most_recent( self, trans, user=None, deleted=False ): + user = user or trans.user + if not user: + return None if trans.history.deleted else trans.history + + #TODO: dup with by_user - should return query from there and call first and not all + history_model = trans.model.History + query = ( trans.sa_session.query( history_model ) + .filter( history_model.user == user ) + .order_by( orm.desc( history_model.table.c.update_time ) ) ) + if not deleted: + query = query.filter( history_model.deleted == False ) + return query.first() # ============================================================================= class HistorySerializer( manager_base.ModelSerializer ): diff -r 898a172941b10e435a6616c8cc04ccec6c7984d3 -r fb6a06ce35f08f516b8a5d80d2105225c243201b lib/galaxy/webapps/galaxy/controllers/history.py --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -1034,7 +1034,14 @@ # No need to check other outputs since the job's parent history is this history job.mark_deleted( trans.app.config.track_jobs_in_database ) trans.app.job_manager.job_stop_queue.put( job.id ) - # Regardless of whether it was previously deleted, get or create default history. + + # Regardless of whether it was previously deleted, get the most recent history or create a new one. + most_recent_history = self.mgrs.histories.most_recent( trans, user=trans.user, deleted=False ) + if most_recent_history: + trans.set_history( most_recent_history ) + return trans.show_ok_message( "History deleted, your most recent history is now active", + refresh_frames=['history'] ) + trans.get_or_create_default_history() return trans.show_ok_message( "History deleted, a new history is active", refresh_frames=['history'] ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.