Move locked check to a guard-clause

This commit is contained in:
Oswaldo Ferreira 2017-10-30 11:21:23 +01:00
parent 7e60c76428
commit c4124fce48
1 changed files with 3 additions and 1 deletions

View File

@ -398,7 +398,9 @@ class MergeRequest < ActiveRecord::Base
def merge_ongoing?
# While the MergeRequest is locked, it should present itself as 'merge ongoing'.
# The unlocking process is handled by StuckMergeJobsWorker scheduled in Cron.
locked? || !!merge_jid && !merged? && Gitlab::SidekiqStatus.running?(merge_jid)
return true if locked?
!!merge_jid && !merged? && Gitlab::SidekiqStatus.running?(merge_jid)
end
def closed_without_fork?