Merge pull request #1818 from riyad/refactor-satellite-actions
Refactor Satellite Code
This commit is contained in:
commit
50a6c614b5
10 changed files with 272 additions and 212 deletions
|
@ -26,15 +26,14 @@ class TreeController < ProjectResourceController
|
|||
end
|
||||
|
||||
def update
|
||||
file_editor = Gitlab::FileEditor.new(current_user, @project, @ref)
|
||||
update_status = file_editor.update(
|
||||
@path,
|
||||
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"
|
||||
|
|
|
@ -60,7 +60,7 @@ class MergeRequest < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def check_if_can_be_merged
|
||||
self.state = if Gitlab::Merge.new(self, self.author).can_be_merged?
|
||||
self.state = if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged?
|
||||
CAN_BE_MERGED
|
||||
else
|
||||
CANNOT_BE_MERGED
|
||||
|
@ -167,7 +167,7 @@ class MergeRequest < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def automerge!(current_user)
|
||||
if Gitlab::Merge.new(self, current_user).merge! && self.unmerged_commits.empty?
|
||||
if Gitlab::Satellite::MergeAction.new(current_user, self).merge! && self.unmerged_commits.empty?
|
||||
self.merge!(current_user.id)
|
||||
true
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ module Repository
|
|||
end
|
||||
|
||||
def satellite
|
||||
@satellite ||= Gitlab::Satellite.new(self)
|
||||
@satellite ||= Gitlab::Satellite::Satellite.new(self)
|
||||
end
|
||||
|
||||
def has_post_receive_file?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue