Check for existing MR only for opened/reopened MR
This commit is contained in:
parent
e7c930a55b
commit
940c05086e
|
|
@ -92,11 +92,13 @@ class MergeRequest < ActiveRecord::Base
|
|||
errors.add :branch_conflict, "You can not use same branch for source and target branches"
|
||||
end
|
||||
|
||||
similar_mrs = self.project.merge_requests.where(source_branch: source_branch, target_branch: target_branch).opened
|
||||
similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id
|
||||
if opened? || reopened?
|
||||
similar_mrs = self.project.merge_requests.where(source_branch: source_branch, target_branch: target_branch).opened
|
||||
similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id
|
||||
|
||||
if similar_mrs.any?
|
||||
errors.add :base, "There is already an open merge request for this branches"
|
||||
if similar_mrs.any?
|
||||
errors.add :base, "There is already an open merge request for this branches"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue