WebEditor: Check if save is possible

This commit is contained in:
Valeriy Sizov 2012-10-12 14:06:12 +03:00
parent e53b47b447
commit 0b3e9fd218
2 changed files with 7 additions and 6 deletions

View file

@ -25,9 +25,8 @@ class TreeController < ProjectResourceController
end
def update
last_commit = @project.commits(@ref, @path, 1).first.sha
file_editor = Gitlab::FileEditor.new(current_user, @project)
if file_editor.can_edit?(@path, last_commit)
file_editor = Gitlab::FileEditor.new(current_user, @project, @ref)
if file_editor.can_edit?(@path, params[:last_commit])
file_editor.update(@path, params[:content])
redirect_to project_tree_path(@project, @id), :notice => "File has been successfully changed"
else