Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 12:09:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 12:09:10 +0300
commitb98fa9ef3d5bead417ae2f325cb64637883264e9 (patch)
tree409f2002dd056f12d82d3959b3e6f012c4087123 /app/controllers/projects/snippets_controller.rb
parent7e3005967df23a957fe1998c8de4f50b412e69e7 (diff)
Add latest changes from gitlab-org/gitlab@master
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