diff options
author | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-12 15:06:12 +0400 |
---|---|---|
committer | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-12 21:07:24 +0400 |
commit | 0b3e9fd2189753ae4007b53c2c588fca741738ef (patch) | |
tree | 54a5053081f189433f258e76918290b9f014ac2e /app | |
parent | e53b47b447b1f1ba8185aa07b8c53102c592ead8 (diff) |
WebEditor: Check if save is possible
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/tree_controller.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/controllers/tree_controller.rb b/app/controllers/tree_controller.rb index 0a67e033b83..08fd8986f8d 100644 --- a/app/controllers/tree_controller.rb +++ b/app/controllers/tree_controller.rb @@ -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 |