Commit ec0a6816 authored by Michał Zając's avatar Michał Zając Committed by Thiago Figueiró

Revert "Create emphemeral IssueLink if Feedback is present"

This reverts commit 76eb2c96, reversing
changes made to 67739c5b.

It appears that GraphQL can't handle records which have id of nil, we
need to revert this change as it prevents our API from working while we
think of a workaround.
parent b5e81899
......@@ -9,16 +9,10 @@ module Resolvers
required: false,
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, **)
links = 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)
issue_links.by_link_type(link_type)
end
private
......
......@@ -8,10 +8,8 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do
describe '#resolve' do
let_it_be(:user) { create(:user) }
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!(: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 }) }
......@@ -26,12 +24,6 @@ RSpec.describe Resolvers::Vulnerabilities::IssueLinksResolver do
let(:filters) { { link_type: 'CREATED' } }
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
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