Commit 893f3f28 authored by tiagonbotelho's avatar tiagonbotelho

refactors update action to change commit_params with the correct path

parent cf96c759
...@@ -274,7 +274,7 @@ GEM ...@@ -274,7 +274,7 @@ GEM
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab_git (10.2.3) gitlab_git (10.3.0)
activesupport (~> 4.0) activesupport (~> 4.0)
charlock_holmes (~> 0.7.3) charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
......
...@@ -8,7 +8,6 @@ module CreatesCommit ...@@ -8,7 +8,6 @@ module CreatesCommit
source_project: @project, source_project: @project,
source_branch: @ref, source_branch: @ref,
target_branch: @target_branch, target_branch: @target_branch,
file_path: @file_path,
previous_path: @previous_path previous_path: @previous_path
) )
......
...@@ -39,16 +39,17 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -39,16 +39,17 @@ class Projects::BlobController < Projects::ApplicationController
def update def update
unless params[:file_name].empty? unless params[:file_name].empty?
@previous_path = @file_path @previous_path = @path
@file_path = params[:file_name] @path = params[:file_name]
@commit_params[:file_path] = @path
end end
after_edit_path = after_edit_path =
if from_merge_request && @target_branch == @ref if from_merge_request && @target_branch == @ref
diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) + diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) +
"#file-path-#{hexdigest(@file_path)}" "#file-path-#{hexdigest(@path)}"
else else
namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @path))
end end
create_commit(Files::UpdateService, success_path: after_edit_path, create_commit(Files::UpdateService, success_path: after_edit_path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment