fix label issue
This commit is contained in:
parent
54a575f1bb
commit
f677aa7d57
|
|
@ -139,13 +139,12 @@ module Gitlab
|
|||
end
|
||||
|
||||
def setup_label
|
||||
return unless @relation_hash['type'] == 'GroupLabel'
|
||||
|
||||
# If there's no group, move the label to a project label
|
||||
if @relation_hash['group_id']
|
||||
if @relation_hash['type'] == 'GroupLabel' && @relation_hash['group_id']
|
||||
@relation_hash['project_id'] = nil
|
||||
@relation_name = :group_label
|
||||
else
|
||||
@relation_hash['group_id'] = nil
|
||||
@relation_hash['type'] = 'ProjectLabel'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -236,12 +236,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
|
|||
labels = project.issues.first.labels
|
||||
|
||||
expect(labels.where(type: "ProjectLabel").count).to eq(results.fetch(:first_issue_labels, 0))
|
||||
expect(labels.where(type: "ProjectLabel").where.not(group_id: nil).count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'restores group correctly' do |**results|
|
||||
it 'has group label' do
|
||||
expect(project.group.labels.size).to eq(results.fetch(:labels, 0))
|
||||
expect(project.group.labels.where(type: "GroupLabel").where.not(project_id: nil).count).to eq(0)
|
||||
end
|
||||
|
||||
it 'has group milestone' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue