summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-23 18:09:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-23 18:09:46 +0000
commitfdd0b0fd4592c74257980d07878db75705d22192 (patch)
treefcf923555aed86fea3842f1074ec45d2864db20c /app/controllers
parent9a9415ab127d5e660c09113238a6fb0a895218e9 (diff)
downloadgitlab-ce-fdd0b0fd4592c74257980d07878db75705d22192.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/concerns/snippets_actions.rb6
-rw-r--r--app/controllers/projects/merge_requests/creations_controller.rb8
-rw-r--r--app/controllers/projects/merge_requests_controller.rb1
-rw-r--r--app/controllers/projects/refs_controller.rb28
-rw-r--r--app/controllers/repositories/git_http_controller.rb8
5 files changed, 15 insertions, 36 deletions
diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb
index 096c6efc0fc..d8113c39351 100644
--- a/app/controllers/concerns/snippets_actions.rb
+++ b/app/controllers/concerns/snippets_actions.rb
@@ -53,10 +53,10 @@ module SnippetsActions
def blob
return unless snippet
- @blob ||= if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty?
- snippet.blobs.first
- else
+ @blob ||= if snippet.empty_repo?
snippet.blob
+ else
+ snippet.blobs.first
end
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb
index 23222cbd37c..28aa1b300aa 100644
--- a/app/controllers/projects/merge_requests/creations_controller.rb
+++ b/app/controllers/projects/merge_requests/creations_controller.rb
@@ -16,7 +16,6 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
end
def create
- @target_branches ||= []
@merge_request = ::MergeRequests::CreateService.new(project, current_user, merge_request_params).execute
if @merge_request.valid?
@@ -97,13 +96,6 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
def define_new_vars
@noteable = @merge_request
-
- @target_branches = if @merge_request.target_project
- @merge_request.target_project.repository.branch_names
- else
- []
- end
-
@target_project = @merge_request.target_project
@source_project = @merge_request.source_project
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 471b12aa4c4..35608361683 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -357,7 +357,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
def define_edit_vars
@source_project = @merge_request.source_project
@target_project = @merge_request.target_project
- @target_branches = @merge_request.target_project.repository.branch_names
@noteable = @merge_request
# FIXME: We have to assign a presenter to another instance variable
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index b4ca9074ca9..db0a17d8ee0 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -40,29 +40,25 @@ class Projects::RefsController < Projects::ApplicationController
end
def logs_tree
- summary = ::Gitlab::TreeSummary.new(
- @commit,
- @project,
- path: @path,
- offset: params[:offset],
- limit: 25
- )
-
- @logs, commits = summary.summarize
- @more_log_url = more_url(summary.next_offset) if summary.more?
+ tree_summary = ::Gitlab::TreeSummary.new(
+ @commit, @project, path: @path, offset: params[:offset], limit: 25)
respond_to do |format|
format.html { render_404 }
format.json do
- response.headers["More-Logs-Url"] = @more_log_url if summary.more?
- response.headers["More-Logs-Offset"] = summary.next_offset if summary.more?
- render json: @logs
+ logs, next_offset = tree_summary.fetch_logs
+
+ response.headers["More-Logs-Offset"] = next_offset if next_offset
+
+ render json: logs
end
- # The commit titles must be rendered and redacted before being shown.
- # Doing it here allows us to apply performance optimizations that avoid
- # N+1 problems
+ # Deprecated due to https://gitlab.com/gitlab-org/gitlab/-/issues/36863
+ # Will be removed soon https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29895
format.js do
+ @logs, commits = tree_summary.summarize
+ @more_log_url = more_url(tree_summary.next_offset) if tree_summary.more?
+
prerender_commit_full_titles!(commits)
end
end
diff --git a/app/controllers/repositories/git_http_controller.rb b/app/controllers/repositories/git_http_controller.rb
index 118036de230..e3dbe6fcbdf 100644
--- a/app/controllers/repositories/git_http_controller.rb
+++ b/app/controllers/repositories/git_http_controller.rb
@@ -4,7 +4,6 @@ module Repositories
class GitHttpController < Repositories::GitHttpClientController
include WorkhorseRequest
- before_action :snippet_request_allowed?
before_action :access_check
prepend_before_action :deny_head_requests, only: [:info_refs]
@@ -121,13 +120,6 @@ module Repositories
def log_user_activity
Users::ActivityService.new(user).execute
end
-
- def snippet_request_allowed?
- if repo_type.snippet? && Feature.disabled?(:version_snippets, user)
- Gitlab::AppLogger.info('Snippet access attempt with feature disabled')
- render plain: 'Snippet git access is disabled.', status: :forbidden
- end
- end
end
end