Commit 9af861aa authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix_issue_args' into 'master'

Fix loading of EE-specific issue args

See merge request gitlab-org/gitlab!45383
parents 9e94ee07 b40486f3
...@@ -26,5 +26,3 @@ module Mutations ...@@ -26,5 +26,3 @@ module Mutations
end end
end end
end end
Mutations::Issues::CommonMutationArguments.prepend_if_ee('::EE::Mutations::Issues::CommonMutationArguments')
...@@ -3471,6 +3471,11 @@ input CreateIssueInput { ...@@ -3471,6 +3471,11 @@ input CreateIssueInput {
""" """
epicId: EpicID epicId: EpicID
"""
The desired health status
"""
healthStatus: HealthStatus
""" """
The IID (internal ID) of a project issue. Only admins and project owners can modify The IID (internal ID) of a project issue. Only admins and project owners can modify
""" """
...@@ -3510,6 +3515,11 @@ input CreateIssueInput { ...@@ -3510,6 +3515,11 @@ input CreateIssueInput {
Title of the issue Title of the issue
""" """
title: String! title: String!
"""
The weight of the issue
"""
weight: Int
} }
""" """
...@@ -19801,6 +19811,11 @@ input UpdateIssueInput { ...@@ -19801,6 +19811,11 @@ input UpdateIssueInput {
""" """
epicId: ID epicId: ID
"""
The desired health status
"""
healthStatus: HealthStatus
""" """
The IID of the issue to mutate The IID of the issue to mutate
""" """
...@@ -19835,6 +19850,11 @@ input UpdateIssueInput { ...@@ -19835,6 +19850,11 @@ input UpdateIssueInput {
Title of the issue Title of the issue
""" """
title: String title: String
"""
The weight of the issue
"""
weight: Int
} }
""" """
......
...@@ -9376,6 +9376,26 @@ ...@@ -9376,6 +9376,26 @@
}, },
"defaultValue": null "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", "name": "epicId",
"description": "The ID of an epic to associate the issue with", "description": "The ID of an epic to associate the issue with",
...@@ -57533,6 +57553,26 @@ ...@@ -57533,6 +57553,26 @@
}, },
"defaultValue": null "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", "name": "epicId",
"description": "The ID of the parent epic. NULL when removing the association", "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 ...@@ -7,6 +7,8 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
include ::Mutations::Issues::CommonEEMutationArguments
argument :epic_id, ::Types::GlobalIDType[::Epic], argument :epic_id, ::Types::GlobalIDType[::Epic],
required: false, required: false,
description: 'The ID of an epic to associate the issue with' description: 'The ID of an epic to associate the issue with'
......
...@@ -7,6 +7,8 @@ module EE ...@@ -7,6 +7,8 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
include ::Mutations::Issues::CommonEEMutationArguments
argument :epic_id, GraphQL::ID_TYPE, argument :epic_id, GraphQL::ID_TYPE,
required: false, required: false,
description: 'The ID of the parent epic. NULL when removing the association' 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