diff options
Diffstat (limited to 'app/presenters/snippet_presenter.rb')
-rw-r--r-- | app/presenters/snippet_presenter.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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) |