Commit 54e71a5c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'jprovazn-fix-link-type-flag-check' into 'master'

Fix feature flag check for issue link types

See merge request gitlab-org/gitlab!23264
parents c575599a fd055d00
...@@ -11,7 +11,7 @@ class LinkedProjectIssueEntity < LinkedIssueEntity ...@@ -11,7 +11,7 @@ class LinkedProjectIssueEntity < LinkedIssueEntity
end end
end end
expose :link_type, if: -> (issue, _) { Feature.enabled?(:issue_link_types, issue.project) } do |issue| expose :link_type, if: -> (*) { Feature.enabled?(:issue_link_types, issuable.project) } do |issue|
issue.issue_link_type issue.issue_link_type
end end
......
...@@ -33,5 +33,21 @@ describe LinkedProjectIssueEntity do ...@@ -33,5 +33,21 @@ describe LinkedProjectIssueEntity do
it { expect(entity.as_json).not_to include(:link_type) } it { expect(entity.as_json).not_to include(:link_type) }
end end
context 'when issue_link_types is not enabled for target issue project' do
before do
stub_feature_flags(issue_link_types: { thing: issue_link.target.project, enabled: false })
end
it { expect(entity.as_json).to include(link_type: 'relates_to') }
end
context 'when issue_link_types is not enabled for source issue project' do
before do
stub_feature_flags(issue_link_types: { thing: issue_link.source.project, enabled: false })
end
it { expect(entity.as_json).not_to include(:link_type) }
end
end end
end end
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