Skip to content

Commit

Permalink
Merge pull request #5664 from mvdbeek/show_error_message_if_no_histor…
Browse files Browse the repository at this point in the history
…y_associated

[18.01] Show error message if user tries purging datasets
  • Loading branch information
martenson committed Mar 8, 2018
2 parents a0fd630 + d60b80a commit 1761d85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/webapps/galaxy/controllers/history.py
Expand Up @@ -1103,7 +1103,7 @@ def _share_histories(self, trans, user, send_to_err, histories=None):
@web.expose
def purge_deleted_datasets(self, trans):
count = 0
if trans.app.config.allow_user_dataset_purge:
if trans.app.config.allow_user_dataset_purge and trans.history:
for hda in trans.history.datasets:
if not hda.deleted or hda.purged:
continue
Expand All @@ -1121,7 +1121,8 @@ def purge_deleted_datasets(self, trans):
except Exception:
log.exception('Unable to purge dataset (%s) on purge of hda (%s):' % (hda.dataset.id, hda.id))
count += 1
return trans.show_ok_message("%d datasets have been deleted permanently" % count, refresh_frames=['history'])
return trans.show_ok_message("%d datasets have been deleted permanently" % count, refresh_frames=['history'])
return trans.show_error_message("Cannot purge deleted datasets from this session.")

@web.expose
def delete(self, trans, id, purge=False):
Expand Down

0 comments on commit 1761d85

Please sign in to comment.