Commit fd055d00 authored by Jan Provaznik's avatar Jan Provaznik

Fix feature flag check for issue link types

Check for the feature flag on the source issue instead of target issue.
parent 905a48b6
...@@ -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