Commit 5210cb3c authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix/approvals_before_merge-import' into 'master'

Fix approvals before merge error while importing projects

Closes #2617

See merge request !2763
parents bab59bce 4113e53a
......@@ -100,7 +100,7 @@ class MergeRequest < ActiveRecord::Base
validates :merge_user, presence: true, if: :merge_when_pipeline_succeeds?, unless: :importing?
validate :validate_branches, unless: [:allow_broken, :importing?, :closed_without_fork?]
validate :validate_fork, unless: :closed_without_fork?
validate :validate_approvals_before_merge
validate :validate_approvals_before_merge, unless: :importing?
validate :validate_target_project, on: :create
scope :by_source_or_target_branch, ->(branch_name) do
......
---
title: Fix approvals before merge error while importing projects
merge_request:
author:
type: fixed
......@@ -2967,7 +2967,8 @@
"action": 1,
"author_id": 1
}
]
],
"approvals_before_merge": 1
},
{
"id": 26,
......
......@@ -33,6 +33,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
expect(saved_project_json).to include({ "visibility_level" => 20 })
end
it 'has approvals_before_merge set' do
expect(saved_project_json['approvals_before_merge']).to eq(1)
end
it 'has milestones' do
expect(saved_project_json['milestones']).not_to be_empty
end
......@@ -241,7 +245,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
issues: [issue],
snippets: [snippet],
releases: [release],
group: group
group: group,
approvals_before_merge: 1
)
project.update_column(:description_html, 'description')
project_label = create(:label, project: project)
......
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