Skip to content

Commit

Permalink
Simplify redirect_to_project method
Browse files Browse the repository at this point in the history
  • Loading branch information
malchua committed Feb 7, 2025
1 parent 60906fb commit 3536eff
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions app/controllers/data_exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,12 @@ def redirect_to_project
redirect_to namespace_project_path(project.parent, project)
end

def redirect_to_workflow_execution # rubocop:disable Metrics/AbcSize
def redirect_to_workflow_execution
workflow_execution = WorkflowExecution.find_by(id: params['identifier'])
submitter = workflow_execution.submitter
if submitter.user_type == 'human'
if workflow_execution.submitter == current_user
redirect_to workflow_execution_path(workflow_execution)
else
namespace = workflow_execution.namespace
redirect_to namespace_project_workflow_execution_path(namespace.parent, namespace.project, workflow_execution)
end
if workflow_execution.submitter == current_user
redirect_to workflow_execution_path(workflow_execution)
else
namespace = Namespace.find_by(puid: submitter.first_name)
namespace = workflow_execution.namespace
redirect_to namespace_project_workflow_execution_path(namespace.parent, namespace.project, workflow_execution)
end
end
Expand Down

0 comments on commit 3536eff

Please sign in to comment.