Commit 5f2283ed authored by charlie ablett's avatar charlie ablett

Merge branch '223770-revert-merge-request-38592' into 'master'

Revert "Create emphemeral IssueLink if Feedback is present"

Closes #223770

See merge request gitlab-org/gitlab!38785
parents 0b8175f9 08e04ac6
...@@ -9,16 +9,10 @@ module Resolvers ...@@ -9,16 +9,10 @@ module Resolvers
required: false, required: false,
description: 'Filter issue links by link type' description: 'Filter issue links by link type'
delegate :issue_links, :finding, :created_issue_links, to: :object, private: true delegate :issue_links, to: :object, private: true
def resolve(link_type: nil, **) def resolve(link_type: nil, **)
links = issue_links_by_link_type(link_type) issue_links_by_link_type(link_type)
return links if links.present? || link_type != 'created'
issue_feedback = finding.issue_feedback
return [] if issue_feedback.blank?
issue_links.build(issue_id: issue_feedback.id, link_type: :created)
end end
private private
......
...@@ -8,10 +8,8 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do ...@@ -8,10 +8,8 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do
describe '#resolve' do describe '#resolve' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:vulnerability) { create(:vulnerability) } let_it_be(:vulnerability) { create(:vulnerability) }
let_it_be(:issue) { create(:issue, project: vulnerability.project) }
let_it_be(:vulnerability_feedback) { create(:vulnerability_feedback, issue: issue, feedback_type: 'issue', project: vulnerability.project) }
let_it_be(:related_issue) { create(:vulnerabilities_issue_link, :related, vulnerability: vulnerability) } let_it_be(:related_issue) { create(:vulnerabilities_issue_link, :related, vulnerability: vulnerability) }
let!(:created_issue) { create(:vulnerabilities_issue_link, :created, vulnerability: vulnerability) } let_it_be(:created_issue) { create(:vulnerabilities_issue_link, :created, vulnerability: vulnerability) }
subject { resolve(described_class, obj: vulnerability, args: filters, ctx: { current_user: user }) } subject { resolve(described_class, obj: vulnerability, args: filters, ctx: { current_user: user }) }
...@@ -26,12 +24,6 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do ...@@ -26,12 +24,6 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do
let(:filters) { { link_type: 'CREATED' } } let(:filters) { { link_type: 'CREATED' } }
it { is_expected.to match_array([created_issue]) } it { is_expected.to match_array([created_issue]) }
context 'and there is no created_issue, but finding has a vulnerability_feedback' do
let!(:created_issue) { nil }
it { is_expected.to all(have_attributes(issue_id: vulnerability_feedback.issue_id, link_type: :created)) }
end
end end
context 'when the filter is `RELATED`' do context 'when the filter is `RELATED`' 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