Refactor EditFileAction#update and rename it to commit!
This commit is contained in:
parent
3080127354
commit
700a784bc9
2 changed files with 24 additions and 14 deletions
|
@ -26,14 +26,14 @@ class TreeController < ProjectResourceController
|
|||
end
|
||||
|
||||
def update
|
||||
file_editor = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path)
|
||||
update_status = file_editor.update(
|
||||
edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path)
|
||||
updated_successfully = edit_file_action.commit!(
|
||||
params[:content],
|
||||
params[:commit_message],
|
||||
params[:last_commit]
|
||||
)
|
||||
|
||||
if update_status
|
||||
if updated_successfully
|
||||
redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
|
||||
else
|
||||
flash[:notice] = "Your changes could not be commited, because the file has been changed"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue