summaryrefslogtreecommitdiff
path: root/app/controllers/projects/snippets_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/snippets_controller.rb')
-rw-r--r--app/controllers/projects/snippets_controller.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index b9c7468890b..8317d9fc6d5 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -66,7 +66,6 @@ class Projects::SnippetsController < Projects::ApplicationController
end
def show
- blob = @snippet.blob
conditionally_expand_blob(blob)
respond_to do |format|
@@ -115,6 +114,16 @@ class Projects::SnippetsController < Projects::ApplicationController
alias_method :awardable, :snippet
alias_method :spammable, :snippet
+ def blob
+ return unless snippet
+
+ @blob ||= if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty?
+ snippet.blobs.first
+ else
+ snippet.blob
+ end
+ end
+
def spammable_path
project_snippet_path(@project, @snippet)
end