summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-11-28 09:08:58 +0000
committerDouwe Maan <douwe@gitlab.com>2018-11-28 09:08:58 +0000
commit5bf893952b82b4877790f5a7932b2f799393c686 (patch)
tree02ae6372f9a0a3b543fc9a785544274d2fca505c
parent385e8f712cb5a8109c46eb33fd8fd5d8e1a4a6a2 (diff)
parent3eadb6237285693f50f0aa8249ebf5186914fdda (diff)
downloadgitlab-ce-5bf893952b82b4877790f5a7932b2f799393c686.tar.gz
Merge branch 'rs-to_h-deprecation' into 'master'
Remove `options` assignment from ExtractsPath See merge request gitlab-org/gitlab-ce!23389
-rw-r--r--app/controllers/projects/network_controller.rb8
-rw-r--r--app/views/projects/find_file/show.html.haml2
-rw-r--r--lib/extracts_path.rb5
3 files changed, 7 insertions, 8 deletions
diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb
index ad2466a8588..6543711ecfa 100644
--- a/app/controllers/projects/network_controller.rb
+++ b/app/controllers/projects/network_controller.rb
@@ -8,6 +8,7 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
+ before_action :assign_options
before_action :assign_commit
def show
@@ -29,10 +30,13 @@ class Projects::NetworkController < Projects::ApplicationController
render
end
+ def assign_options
+ @options = params.permit(:filter_ref, :extended_sha1)
+ end
+
def assign_commit
- return if params[:extended_sha1].blank?
+ return if @options[:extended_sha1].blank?
- @options[:extended_sha1] = params[:extended_sha1]
@commit = @repo.commit(@options[:extended_sha1])
end
diff --git a/app/views/projects/find_file/show.html.haml b/app/views/projects/find_file/show.html.haml
index 996c7b1b960..82f035f24da 100644
--- a/app/views/projects/find_file/show.html.haml
+++ b/app/views/projects/find_file/show.html.haml
@@ -1,6 +1,6 @@
- page_title "Find File", @ref
-.file-finder-holder.tree-holder.clearfix.js-file-finder{ 'data-file-find-url': "#{escape_javascript(project_files_path(@project, @ref, @options.merge(format: :json)))}", 'data-find-tree-url': escape_javascript(project_tree_path(@project, @ref)), 'data-blob-url-template': escape_javascript(project_blob_path(@project, @id || @commit.id)) }
+.file-finder-holder.tree-holder.clearfix.js-file-finder{ 'data-file-find-url': "#{escape_javascript(project_files_path(@project, @ref, format: :json))}", 'data-find-tree-url': escape_javascript(project_tree_path(@project, @ref)), 'data-blob-url-template': escape_javascript(project_blob_path(@project, @id || @commit.id)) }
.nav-block
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'find_file', path: @path
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 655278da711..b2c8d46ede1 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -110,11 +110,6 @@ module ExtractsPath
# resolved (e.g., when a user inserts an invalid path or ref).
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def assign_ref_vars
- # assign allowed options
- allowed_options = ["filter_ref"]
- @options = params.select {|key, value| allowed_options.include?(key) && !value.blank? }
- @options = HashWithIndifferentAccess.new(@options)
-
@id = get_id
@ref, @path = extract_ref(@id)
@repo = @project.repository