Commit 7b975e61 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '34335-move-subscribed-field-to-issue-type' into 'master'

Move subscribed field to IssueType

See merge request gitlab-org/gitlab!19458
parents 47f8ad83 a34065a9
# frozen_string_literal: true
module Types
class ExtendedIssueType < IssueType
graphql_name 'ExtendedIssue'
authorize :read_issue
expose_permissions Types::PermissionTypes::Issue
present_using IssuePresenter
field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5,
description: 'Boolean flag for whether the currently logged in user is subscribed to this issue'
end
end
......@@ -68,6 +68,8 @@ module Types
field :participants, Types::UserType.connection_type, null: true, complexity: 5,
description: 'List of participants in the issue'
field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5,
description: 'Boolean flag for whether the currently logged in user is subscribed to this issue'
field :time_estimate, GraphQL::INT_TYPE, null: false,
description: 'Time estimate of the issue'
field :total_time_spent, GraphQL::INT_TYPE, null: false,
......
......@@ -135,7 +135,7 @@ module Types
resolver: Resolvers::IssuesResolver
field :issue,
Types::ExtendedIssueType,
Types::IssueType,
null: true,
description: 'A single issue of the project',
resolver: Resolvers::IssuesResolver.single
......
---
title: Expose subscribed field in issue lists queried with GraphQL
merge_request: 19458
author: briankabiro
type: changed
......@@ -1625,6 +1625,11 @@ type EpicIssue implements Noteable {
"""
state: IssueState!
"""
Boolean flag for whether the currently logged in user is subscribed to this issue
"""
subscribed: Boolean!
"""
Task completion status of the issue
"""
......@@ -1908,276 +1913,6 @@ type EpicTreeReorderPayload {
errors: [String!]!
}
type ExtendedIssue implements Noteable {
"""
Assignees of the issue
"""
assignees(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): UserConnection
"""
User that created the issue
"""
author: User!
"""
Timestamp of when the issue was closed
"""
closedAt: Time
"""
Indicates the issue is confidential
"""
confidential: Boolean!
"""
Timestamp of when the issue was created
"""
createdAt: Time!
"""
Description of the issue
"""
description: String
"""
The GitLab Flavored Markdown rendering of `description`
"""
descriptionHtml: String
designCollection: DesignCollection
designs: DesignCollection @deprecated(reason: "use design_collection")
"""
Indicates discussion is locked on the issue
"""
discussionLocked: Boolean!
"""
All discussions on this noteable
"""
discussions(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): DiscussionConnection!
"""
Number of downvotes the issue has received
"""
downvotes: Int!
"""
Due date of the issue
"""
dueDate: Time
"""
The epic to which issue belongs
"""
epic: Epic
"""
Internal ID of the issue
"""
iid: ID!
"""
Labels of the issue
"""
labels(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): LabelConnection
"""
Milestone of the issue
"""
milestone: Milestone
"""
All notes on this noteable
"""
notes(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): NoteConnection!
"""
List of participants in the issue
"""
participants(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): UserConnection
"""
Internal reference of the issue. Returned in shortened format by default
"""
reference(
"""
Boolean option specifying whether the reference should be returned in full
"""
full: Boolean = false
): String!
"""
Relative position of the issue (used for positioning in epic tree and issue boards)
"""
relativePosition: Int
"""
State of the issue
"""
state: IssueState!
"""
Boolean flag for whether the currently logged in user is subscribed to this issue
"""
subscribed: Boolean!
"""
Task completion status of the issue
"""
taskCompletionStatus: TaskCompletionStatus!
"""
Time estimate of the issue
"""
timeEstimate: Int!
"""
Title of the issue
"""
title: String!
"""
The GitLab Flavored Markdown rendering of `title`
"""
titleHtml: String
"""
Total time reported as spent on the issue
"""
totalTimeSpent: Int!
"""
Timestamp of when the issue was last updated
"""
updatedAt: Time!
"""
Number of upvotes the issue has received
"""
upvotes: Int!
"""
Number of user notes of the issue
"""
userNotesCount: Int!
"""
Permissions for the current user on the resource
"""
userPermissions: IssuePermissions!
"""
Web path of the issue
"""
webPath: String!
"""
Web URL of the issue
"""
webUrl: String!
weight: Int
}
type Group {
"""
Avatar URL of the group
......@@ -2626,6 +2361,11 @@ type Issue implements Noteable {
"""
state: IssueState!
"""
Boolean flag for whether the currently logged in user is subscribed to this issue
"""
subscribed: Boolean!
"""
Task completion status of the issue
"""
......@@ -4270,7 +4010,7 @@ type Project {
Issues updated before this date
"""
updatedBefore: Time
): ExtendedIssue
): Issue
"""
Issues of the project
......
......@@ -254,6 +254,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `webPath` | String! | Web path of the issue |
| `webUrl` | String! | Web URL of the issue |
| `relativePosition` | Int | Relative position of the issue (used for positioning in epic tree and issue boards) |
| `subscribed` | Boolean! | Boolean flag for whether the currently logged in user is subscribed to this issue |
| `timeEstimate` | Int! | Time estimate of the issue |
| `totalTimeSpent` | Int! | Total time reported as spent on the issue |
| `closedAt` | Time | Timestamp of when the issue was closed |
......@@ -296,41 +297,6 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `clientMutationId` | String | A unique identifier for the client performing the mutation. |
| `errors` | String! => Array | Reasons why the mutation failed. |
### ExtendedIssue
| Name | Type | Description |
| --- | ---- | ---------- |
| `userPermissions` | IssuePermissions! | Permissions for the current user on the resource |
| `iid` | ID! | Internal ID of the issue |
| `title` | String! | Title of the issue |
| `titleHtml` | String | The GitLab Flavored Markdown rendering of `title` |
| `description` | String | Description of the issue |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `state` | IssueState! | State of the issue |
| `reference` | String! | Internal reference of the issue. Returned in shortened format by default |
| `author` | User! | User that created the issue |
| `milestone` | Milestone | Milestone of the issue |
| `dueDate` | Time | Due date of the issue |
| `confidential` | Boolean! | Indicates the issue is confidential |
| `discussionLocked` | Boolean! | Indicates discussion is locked on the issue |
| `upvotes` | Int! | Number of upvotes the issue has received |
| `downvotes` | Int! | Number of downvotes the issue has received |
| `userNotesCount` | Int! | Number of user notes of the issue |
| `webPath` | String! | Web path of the issue |
| `webUrl` | String! | Web URL of the issue |
| `relativePosition` | Int | Relative position of the issue (used for positioning in epic tree and issue boards) |
| `timeEstimate` | Int! | Time estimate of the issue |
| `totalTimeSpent` | Int! | Total time reported as spent on the issue |
| `closedAt` | Time | Timestamp of when the issue was closed |
| `createdAt` | Time! | Timestamp of when the issue was created |
| `updatedAt` | Time! | Timestamp of when the issue was last updated |
| `taskCompletionStatus` | TaskCompletionStatus! | Task completion status of the issue |
| `epic` | Epic | The epic to which issue belongs |
| `weight` | Int | |
| `designs` | DesignCollection | |
| `designCollection` | DesignCollection | |
| `subscribed` | Boolean! | Boolean flag for whether the currently logged in user is subscribed to this issue |
### Group
| Name | Type | Description |
......@@ -382,6 +348,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `webPath` | String! | Web path of the issue |
| `webUrl` | String! | Web URL of the issue |
| `relativePosition` | Int | Relative position of the issue (used for positioning in epic tree and issue boards) |
| `subscribed` | Boolean! | Boolean flag for whether the currently logged in user is subscribed to this issue |
| `timeEstimate` | Int! | Time estimate of the issue |
| `totalTimeSpent` | Int! | Total time reported as spent on the issue |
| `closedAt` | Time | Timestamp of when the issue was closed |
......@@ -678,7 +645,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `statistics` | ProjectStatistics | Statistics of the project |
| `repository` | Repository | Git repository of the project |
| `mergeRequest` | MergeRequest | A single merge request of the project |
| `issue` | ExtendedIssue | A single issue of the project |
| `issue` | Issue | A single issue of the project |
### ProjectPermissions
......
# frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['ExtendedIssue'] do
it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Issue) }
it { expect(described_class.graphql_name).to eq('ExtendedIssue') }
it { expect(described_class).to require_graphql_authorizations(:read_issue) }
it { expect(described_class.interfaces).to include(Types::Notes::NoteableType.to_graphql) }
it 'has specific fields' do
fields = Types::IssueType.fields.keys + [:subscribed]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
end
end
end
......@@ -14,7 +14,7 @@ describe GitlabSchema.types['Issue'] do
it 'has specific fields' do
fields = %i[iid title description state reference author assignees participants labels milestone due_date
confidential discussion_locked upvotes downvotes user_notes_count web_path web_url relative_position
time_estimate total_time_spent closed_at created_at updated_at task_completion_status]
subscribed time_estimate total_time_spent closed_at created_at updated_at task_completion_status]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
......
......@@ -33,7 +33,7 @@ describe GitlabSchema.types['Project'] do
subject { described_class.fields['issue'] }
it 'returns issue' do
is_expected.to have_graphql_type(Types::ExtendedIssueType)
is_expected.to have_graphql_type(Types::IssueType)
is_expected.to have_graphql_resolver(Resolvers::IssuesResolver.single)
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