Commit 313bcadb authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-issue-197300' into 'master'

Fix issue CSV export failing for some projects

Closes #197300

See merge request gitlab-org/gitlab!23223
parents 59bea37b 31a3cff7
---
title: Fix issue CSV export failing for some projects
merge_request: 23223
author:
type: fixed
......@@ -11,7 +11,7 @@ module EE
relation = unscoped.where(id: self.select(:id)).eager_load(:labels)
relation.pluck(:id, 'labels.title').each do |issue_id, label|
issue_labels[issue_id] << label
issue_labels[issue_id] << label if label.present?
end
issue_labels
......
......@@ -37,6 +37,23 @@ describe EE::Issuable do
expect(relation.labels_hash[issue_id]).to include('Feature', 'Second Label')
end
# This tests the workaround for the lack of a NOT NULL constraint in
# label_links.label_id:
# https://gitlab.com/gitlab-org/gitlab/issues/197307
context 'with a NULL label ID in the link' do
let(:issue) { create(:labeled_issue, labels: [feature_label, second_label]) }
before do
label_link = issue.label_links.find_by(label_id: second_label.id)
label_link.label_id = nil
label_link.save(validate: false)
end
it 'filters out bad labels' do
expect(Issue.where(id: issue.id).labels_hash[issue.id]).to match_array(['Feature'])
end
end
end
describe '#matches_cross_reference_regex?' do
......
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