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 ...@@ -60,7 +60,7 @@ class MergeRequest < ActiveRecord::Base
end end
def check_if_can_be_merged 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 CAN_BE_MERGED
else else
CANNOT_BE_MERGED CANNOT_BE_MERGED
...@@ -167,7 +167,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -167,7 +167,7 @@ class MergeRequest < ActiveRecord::Base
end end
def automerge!(current_user) 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) self.merge!(current_user.id)
true true
end end
......
...@@ -5,10 +5,10 @@ module Gitlab ...@@ -5,10 +5,10 @@ module Gitlab
attr_accessor :options, :project, :user attr_accessor :options, :project, :user
def initialize(project, user, options = {}) def initialize(user, project, options = {})
@options = DEFAULT_OPTIONS.merge(options)
@project = project @project = project
@user = user @user = user
@options = DEFAULT_OPTIONS.merge(options)
end end
protected protected
......
...@@ -3,8 +3,8 @@ module Gitlab ...@@ -3,8 +3,8 @@ module Gitlab
class MergeAction < Action class MergeAction < Action
attr_accessor :merge_request attr_accessor :merge_request
def initialize(merge_request, user) def initialize(user, merge_request)
super merge_request.project, user super user, merge_request.project
@merge_request = merge_request @merge_request = merge_request
end 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