diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 09:09:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 09:09:10 +0000 |
commit | b98fa9ef3d5bead417ae2f325cb64637883264e9 (patch) | |
tree | 409f2002dd056f12d82d3959b3e6f012c4087123 /app/presenters | |
parent | 7e3005967df23a957fe1998c8de4f50b412e69e7 (diff) | |
download | gitlab-ce-b98fa9ef3d5bead417ae2f325cb64637883264e9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/snippet_blob_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/snippet_presenter.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/presenters/snippet_blob_presenter.rb b/app/presenters/snippet_blob_presenter.rb index 70a373619d6..8e593d3a5fe 100644 --- a/app/presenters/snippet_blob_presenter.rb +++ b/app/presenters/snippet_blob_presenter.rb @@ -32,7 +32,7 @@ class SnippetBlobPresenter < BlobPresenter end def snippet - blob.snippet + blob.container end def language diff --git a/app/presenters/snippet_presenter.rb b/app/presenters/snippet_presenter.rb index a453be18b95..ba9d566932a 100644 --- a/app/presenters/snippet_presenter.rb +++ b/app/presenters/snippet_presenter.rb @@ -27,6 +27,14 @@ class SnippetPresenter < Gitlab::View::Presenter::Delegated snippet.submittable_as_spam_by?(current_user) end + def blob + if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty? + snippet.blobs.first + else + snippet.blob + end + end + private def can_access_resource?(ability_prefix) |