Commit 5f16687805b4daa98f7227849d064345e68210d2

Authored by Riyad Preukschas
1 parent 55779b00

Update arguments for Gitlab::Satellite::EditFileAction#initialize

app/controllers/tree_controller.rb
... ... @@ -26,9 +26,8 @@ class TreeController < ProjectResourceController
26 26 end
27 27  
28 28 def update
29   - file_editor = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref)
  29 + file_editor = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path)
30 30 update_status = file_editor.update(
31   - @path,
32 31 params[:content],
33 32 params[:commit_message],
34 33 params[:last_commit]
... ...
lib/gitlab/satellite/edit_file_action.rb
... ... @@ -5,15 +5,16 @@ module Gitlab
5 5 # It gives you ability to make changes to files
6 6 # & commit this changes from GitLab UI.
7 7 class EditFileAction < Action
8   - attr_accessor :ref
  8 + attr_accessor :path, :ref
9 9  
10   - def initialize(user, project, ref)
  10 + def initialize(user, project, ref, path)
11 11 super user, project
  12 + @path = path
12 13 @ref = ref
13 14 end
14 15  
15   - def update(path, content, commit_message, last_commit)
16   - return false unless can_edit?(path, last_commit)
  16 + def update(content, commit_message, last_commit)
  17 + return false unless can_edit?(last_commit)
17 18  
18 19 in_locked_and_timed_satellite do |repo|
19 20 prepare_satellite!(repo)
... ... @@ -34,7 +35,7 @@ module Gitlab
34 35  
35 36 protected
36 37  
37   - def can_edit?(path, last_commit)
  38 + def can_edit?(last_commit)
38 39 current_last_commit = @project.last_commit_for(ref, path).sha
39 40 last_commit == current_last_commit
40 41 end
... ...