Skip to content

Commit

Permalink
Merge pull request #18932 from mvdbeek/fix_report_username
Browse files Browse the repository at this point in the history
[24.1] Fix username used in invocation report
  • Loading branch information
davelopez authored Oct 3, 2024
2 parents f93407a + ed1e886 commit 40fbe9a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/galaxy/workflow/reports/generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ready_galaxy_markdown_for_export,
resolve_invocation_markdown,
)
from galaxy.model import WorkflowInvocation
from galaxy.schema import PdfDocumentType


Expand All @@ -35,7 +36,7 @@ def generate_report_pdf(self, trans, invocation, runtime_report_config_json=None
class WorkflowMarkdownGeneratorPlugin(WorkflowReportGeneratorPlugin, metaclass=ABCMeta):
"""WorkflowReportGeneratorPlugin that generates markdown as base report."""

def generate_report_json(self, trans, invocation, runtime_report_config_json=None):
def generate_report_json(self, trans, invocation: WorkflowInvocation, runtime_report_config_json=None):
""" """
workflow_manager = workflows.WorkflowsManager(trans.app)
workflow_encoded_id = trans.app.security.encode_id(invocation.workflow_id)
Expand All @@ -44,13 +45,15 @@ def generate_report_json(self, trans, invocation, runtime_report_config_json=Non
trans, invocation, runtime_report_config_json=runtime_report_config_json
)
export_markdown, extra_rendering_data = ready_galaxy_markdown_for_export(trans, internal_markdown)
# Invocations can only be run on history, and user must exist, so this should always work
username = invocation.history and invocation.history.user and invocation.history.user.username
rval = {
"render_format": "markdown", # Presumably the frontend could render things other ways.
"markdown": export_markdown,
"invocation_markdown": export_markdown,
"model_class": "Report",
"id": trans.app.security.encode_id(invocation.workflow_id),
"username": trans.user.username,
"username": username,
"title": workflow.name,
}
rval.update(extra_rendering_data)
Expand Down

0 comments on commit 40fbe9a

Please sign in to comment.