Commit b40486f3 authored by Jan Provaznik's avatar Jan Provaznik

Fix loading of EE-specific issue args

EE-specific common args were included in a prepended module, so
these were actually never loaded. TO avoid this we include them
explicitly in update/create mutations.
parent 80a34e2b
......@@ -26,5 +26,3 @@ module Mutations
end
end
end
Mutations::Issues::CommonMutationArguments.prepend_if_ee('::EE::Mutations::Issues::CommonMutationArguments')
......@@ -3471,6 +3471,11 @@ input CreateIssueInput {
"""
epicId: EpicID
"""
The desired health status
"""
healthStatus: HealthStatus
"""
The IID (internal ID) of a project issue. Only admins and project owners can modify
"""
......@@ -3510,6 +3515,11 @@ input CreateIssueInput {
Title of the issue
"""
title: String!
"""
The weight of the issue
"""
weight: Int
}
"""
......@@ -19652,6 +19662,11 @@ input UpdateIssueInput {
"""
epicId: ID
"""
The desired health status
"""
healthStatus: HealthStatus
"""
The IID of the issue to mutate
"""
......@@ -19686,6 +19701,11 @@ input UpdateIssueInput {
Title of the issue
"""
title: String
"""
The weight of the issue
"""
weight: Int
}
"""
......
......@@ -9376,6 +9376,26 @@
},
"defaultValue": null
},
{
"name": "healthStatus",
"description": "The desired health status",
"type": {
"kind": "ENUM",
"name": "HealthStatus",
"ofType": null
},
"defaultValue": null
},
{
"name": "weight",
"description": "The weight of the issue",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "epicId",
"description": "The ID of an epic to associate the issue with",
......@@ -57095,6 +57115,26 @@
},
"defaultValue": null
},
{
"name": "healthStatus",
"description": "The desired health status",
"type": {
"kind": "ENUM",
"name": "HealthStatus",
"ofType": null
},
"defaultValue": null
},
{
"name": "weight",
"description": "The weight of the issue",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "epicId",
"description": "The ID of the parent epic. NULL when removing the association",
# frozen_string_literal: true
module EE
module Mutations
module Issues
module CommonMutationArguments
extend ActiveSupport::Concern
included do
argument :health_status,
::Types::HealthStatusEnum,
required: false,
description: 'The desired health status'
argument :weight, GraphQL::INT_TYPE,
required: false,
description: 'The weight of the issue'
end
end
end
end
end
......@@ -7,6 +7,8 @@ module EE
extend ActiveSupport::Concern
prepended do
include ::Mutations::Issues::CommonEEMutationArguments
argument :epic_id, ::Types::GlobalIDType[::Epic],
required: false,
description: 'The ID of an epic to associate the issue with'
......
......@@ -7,6 +7,8 @@ module EE
extend ActiveSupport::Concern
prepended do
include ::Mutations::Issues::CommonEEMutationArguments
argument :epic_id, GraphQL::ID_TYPE,
required: false,
description: 'The ID of the parent epic. NULL when removing the association'
......
# frozen_string_literal: true
module Mutations
module Issues
module CommonEEMutationArguments
extend ActiveSupport::Concern
included do
argument :health_status,
::Types::HealthStatusEnum,
required: false,
description: 'The desired health status'
argument :weight, GraphQL::INT_TYPE,
required: false,
description: 'The weight of the issue'
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Create an issue' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:input) do
{
'title' => 'new title',
'weight' => 2,
'healthStatus' => 'atRisk'
}
end
let(:mutation) { graphql_mutation(:createIssue, input.merge('projectPath' => project.full_path)) }
let(:mutation_response) { graphql_mutation_response(:create_issue) }
before do
stub_licensed_features(issuable_health_status: true)
project.add_developer(current_user)
end
it 'creates the issue' do
post_graphql_mutation(mutation, current_user: current_user)
expect(response).to have_gitlab_http_status(:success)
expect(mutation_response['issue']).to include(input)
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Update of an existing issue' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project) }
let(:input) do
{
'iid' => issue.iid.to_s,
'weight' => 2,
'healthStatus' => 'atRisk'
}
end
let(:mutation) { graphql_mutation(:update_issue, input.merge(project_path: project.full_path)) }
let(:mutation_response) { graphql_mutation_response(:update_issue) }
before do
stub_licensed_features(issuable_health_status: true)
project.add_developer(current_user)
end
it 'updates the issue' do
post_graphql_mutation(mutation, current_user: current_user)
expect(response).to have_gitlab_http_status(:success)
expect(mutation_response['issue']).to include(input)
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