Commit 3161d5d2 authored by tiagonbotelho's avatar tiagonbotelho

refactors update action to change commit_params with the correct path

parent 2298c003
......@@ -274,7 +274,7 @@ GEM
diff-lcs (~> 1.1)
mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3)
gitlab_git (10.2.3)
gitlab_git (10.3.0)
activesupport (~> 4.0)
charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0)
......
......@@ -8,7 +8,6 @@ module CreatesCommit
source_project: @project,
source_branch: @ref,
target_branch: @target_branch,
file_path: @file_path,
previous_path: @previous_path
)
......
......@@ -39,16 +39,17 @@ class Projects::BlobController < Projects::ApplicationController
def update
unless params[:file_name].empty?
@previous_path = @file_path
@file_path = params[:file_name]
@previous_path = @path
@path = params[:file_name]
@commit_params[:file_path] = @path
end
after_edit_path =
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) +
"#file-path-#{hexdigest(@file_path)}"
"#file-path-#{hexdigest(@path)}"
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
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