Change argument order for satellite actions to always start with the user

This commit is contained in:
Riyad Preukschas 2012-10-26 00:26:47 +02:00
parent 35b7a53955
commit 8c89beb6f9
3 changed files with 6 additions and 6 deletions

View file

@ -60,7 +60,7 @@ class MergeRequest < ActiveRecord::Base
end
def check_if_can_be_merged
self.state = if Gitlab::Satellite::MergeAction.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::Satellite::MergeAction.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

View file

@ -5,10 +5,10 @@ module Gitlab
attr_accessor :options, :project, :user
def initialize(project, user, options = {})
def initialize(user, project, options = {})
@options = DEFAULT_OPTIONS.merge(options)
@project = project
@user = user
@options = DEFAULT_OPTIONS.merge(options)
end
protected

View file

@ -3,8 +3,8 @@ module Gitlab
class MergeAction < Action
attr_accessor :merge_request
def initialize(merge_request, user)
super merge_request.project, user
def initialize(user, merge_request)
super user, merge_request.project
@merge_request = merge_request
end