Commit 6bde5f57 authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by Douglas Barbosa Alexandre

Improve response from Jira issue creation from vulnerability

This change fixes problem with response from GraphQL mutation that
creates issue in Jira.
parent 2c4280cf
......@@ -7,8 +7,6 @@ module Resolvers
type Types::ExternalIssueType, null: true
def resolve
return serialize_external_issue(object.external_issue, object.external_type) if object.external_issue.present?
BatchLoader::GraphQL.for(object.external_issue_key).batch(key: object.external_type) do |external_issue_keys, loader, args|
case args[:key]
when 'jira'
......
......@@ -18,7 +18,5 @@ module Vulnerabilities
message: N_('already has a "created" issue link')
},
if: :created?
attr_accessor :external_issue
end
end
......@@ -21,7 +21,6 @@ module VulnerabilityExternalIssueLinks
error(external_issue.errors.values)
else
if external_issue_link.update(external_issue_key: external_issue.id)
external_issue_link.external_issue = external_issue
success
else
error(external_issue_link.errors.full_messages)
......
---
title: Improve response from Jira issue creation from vulnerability
merge_request: 50150
author:
type: fixed
......@@ -98,10 +98,10 @@ RSpec.describe 'Creating an External Issue Link' do
context 'and saving external issue link succeeds' do
let(:external_issue_id) { '10000' }
it 'creates the external issue link', :aggregate_failures do
it 'creates the external issue link and returns nil for external issue to be fetched using query', :aggregate_failures do
expect { post_graphql_mutation(mutation, current_user: current_user) }.to change(Vulnerabilities::ExternalIssueLink, :count).by(1)
expect(mutation_response['errors']).to be_empty
expect(mutation_response.dig('externalIssueLink', 'externalIssue', 'relativeReference')).to eq('GV-5')
expect(mutation_response.dig('externalIssueLink', 'externalIssue')).to be_nil
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