Skip to content

Commit

Permalink
Merge pull request #16930 from dannon/workflow-annotation-export
Browse files Browse the repository at this point in the history
[23.1] Include owner's annotation when exporting workflow
  • Loading branch information
mvdbeek authored Oct 27, 2023
2 parents 6df3182 + e48e490 commit a2e3972
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,9 +1335,16 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
"""
annotation_str = ""
tag_str = ""
annotation_owner = None
if stored is not None:
if stored.id:
annotation_str = self.get_item_annotation_str(trans.sa_session, trans.user, stored) or ""
# if the active user doesn't have an annotation on the workflow, default to the owner's annotation.
annotation_owner = stored.user
annotation_str = (
self.get_item_annotation_str(trans.sa_session, trans.user, stored)
or self.get_item_annotation_str(trans.sa_session, annotation_owner, stored)
or ""
)
tag_str = stored.make_tag_string_list()
else:
# dry run with flushed workflow objects, just use the annotation
Expand Down Expand Up @@ -1370,8 +1377,10 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
module = module_factory.from_workflow_step(trans, step)
if not module:
raise exceptions.MessageException(f"Unrecognized step type: {step.type}")
# Get user annotation.
# Get user annotation if it exists, otherwise get owner annotation.
annotation_str = self.get_item_annotation_str(trans.sa_session, trans.user, step) or ""
if not annotation_str and annotation_owner:
annotation_str = self.get_item_annotation_str(trans.sa_session, annotation_owner, step) or ""
content_id = module.get_content_id() if allow_upgrade else step.content_id
# Export differences for backward compatibility
tool_state = module.get_export_state()
Expand Down

0 comments on commit a2e3972

Please sign in to comment.