Commit b5007c15 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename MergeRequest#lock! to #lock_mr!

As a warning from the StateMachine gem points out to us, there already
exists a method ActiveRecord#lock!. This change renames the `lock` and
`unlock` events defined on MergeRequest to `lock_mr` and `unlock_mr`.
parent 024e0577
...@@ -62,11 +62,11 @@ class MergeRequest < ActiveRecord::Base ...@@ -62,11 +62,11 @@ class MergeRequest < ActiveRecord::Base
transition closed: :reopened transition closed: :reopened
end end
event :lock do event :lock_mr do
transition [:reopened, :opened] => :locked transition [:reopened, :opened] => :locked
end end
event :unlock do event :unlock_mr do
transition locked: :reopened transition locked: :reopened
end end
......
...@@ -6,7 +6,7 @@ module MergeRequests ...@@ -6,7 +6,7 @@ module MergeRequests
# Called when you do merge via GitLab UI # Called when you do merge via GitLab UI
class AutoMergeService < BaseMergeService class AutoMergeService < BaseMergeService
def execute(merge_request, current_user, commit_message) def execute(merge_request, current_user, commit_message)
merge_request.lock merge_request.lock_mr
if Gitlab::Satellite::MergeAction.new(current_user, merge_request).merge!(commit_message) if Gitlab::Satellite::MergeAction.new(current_user, merge_request).merge!(commit_message)
merge_request.merge merge_request.merge
...@@ -17,11 +17,11 @@ module MergeRequests ...@@ -17,11 +17,11 @@ module MergeRequests
true true
else else
merge_request.unlock merge_request.unlock_mr
false false
end end
rescue rescue
merge_request.unlock if merge_request.locked? merge_request.unlock_mr if merge_request.locked?
merge_request.mark_as_unmergeable merge_request.mark_as_unmergeable
false false
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