Commit cc2070a9 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '247059-fix-epic-id-param' into 'master'

Fix parsing epic_id id type param

See merge request gitlab-org/gitlab!41869
parents 2a4b477b 5764dcb7
......@@ -16,6 +16,12 @@ module EE
required: false,
description: 'The ID of the parent epic. NULL when removing the association'
end
def resolve(project_path:, iid:, **args)
args[:epic_id] = ::GitlabSchema.parse_gid(args[:epic_id], expected_type: ::Epic).model_id if args[:epic_id]
super
end
end
end
end
......
......@@ -15,7 +15,7 @@ RSpec.describe Mutations::Issues::Update do
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:epic) { create(:epic, group: group) }
let(:epic_id) { epic.id }
let(:epic_id) { epic.to_global_id.to_s }
let(:params) { { project_path: project.full_path, iid: issue.iid, epic_id: epic_id } }
let(:mutated_issue) { subject[:issue] }
let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
......@@ -48,14 +48,26 @@ RSpec.describe Mutations::Issues::Update do
context 'when a valid epic is given' do
it 'updates the epic' do
expect { subject }.to change { issue.reload.epic }.from(nil).to(epic)
end
it 'returns the updated issue' do
expect(mutated_issue.epic).to eq(epic)
end
end
context 'when nil epic is given' do
before do
issue.update!(epic: epic)
end
let(:epic_id) { nil }
it 'set the epic to nil' do
expect { subject }.to change { issue.reload.epic }.from(epic).to(nil)
end
it 'returns the updated issue' do
expect(mutated_issue.epic).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