Commit 8c89beb6 authored by Riyad Preukschas's avatar Riyad Preukschas

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

parent 35b7a539
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment