diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-28 03:15:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-28 03:15:57 +0000 |
commit | c5f4c801a6b40e7ee4b96aba20bbec687ccf0502 (patch) | |
tree | ad58e3d5ca9b38d0e86a78143f12362bb35ea1be /app/presenters | |
parent | 3235221bc498ca3c80eeca505fb32bf9f237778a (diff) | |
download | gitlab-ce-c5f4c801a6b40e7ee4b96aba20bbec687ccf0502.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/blob_presenter.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb index 2577fcaf303..3fb7b1c51ed 100644 --- a/app/presenters/blob_presenter.rb +++ b/app/presenters/blob_presenter.rb @@ -79,6 +79,18 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated url_helpers.project_blob_path(project, File.join(project.repository.commit.sha, blob.path)) end + def environment_formatted_external_url + return unless environment + + environment.formatted_external_url + end + + def environment_external_url_for_route_map + return unless environment + + environment.external_url_for(blob.path, blob.commit_id) + end + # Will be overridden in EE def code_owners [] @@ -122,6 +134,12 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated Gitlab::Routing.url_helpers end + def environment + environment_params = project.repository.branch_exists?(blob.commit_id) ? { ref: blob.commit_id } : { sha: blob.commit_id } + environment_params[:find_latest] = true + ::Environments::EnvironmentsByDeploymentsFinder.new(project, current_user, environment_params).execute.last + end + def project blob.repository.project end |