diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /app/graphql/types/issue_type.rb | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-15.9.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'app/graphql/types/issue_type.rb')
-rw-r--r-- | app/graphql/types/issue_type.rb | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 4948063610a..1e5833a5cf0 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -54,19 +54,24 @@ module Types description: 'Indicates the issue is confidential.' field :discussion_locked, GraphQL::Types::Boolean, null: false, description: 'Indicates discussion is locked on the issue.' - field :due_date, Types::TimeType, null: true, - description: 'Due date of the issue.' - field :hidden, GraphQL::Types::Boolean, null: true, resolver_method: :hidden?, - description: 'Indicates the issue is hidden because the author has been banned. ' \ - 'Will always return `null` if `ban_user_feature_flag` feature flag is disabled.' - field :downvotes, GraphQL::Types::Int, null: false, description: 'Number of downvotes the issue has received.', resolver: Resolvers::DownVotesCountResolver + field :due_date, Types::TimeType, null: true, + description: 'Due date of the issue.' + field :hidden, GraphQL::Types::Boolean, null: true, + description: 'Indicates the issue is hidden because the author has been banned.', method: :hidden? field :merge_requests_count, GraphQL::Types::Int, null: false, description: 'Number of merge requests that close the issue on merge.', resolver: Resolvers::MergeRequestsCountResolver + + field :related_merge_requests, Types::MergeRequestType.connection_type, + null: true, + description: 'Merge requests related to the issue. This field can only be resolved for one issue in any single request.' do + extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 + end + field :relative_position, GraphQL::Types::Int, null: true, description: 'Relative position of the issue (used for positioning in epic tree and issue boards).' field :upvotes, GraphQL::Types::Int, @@ -182,6 +187,17 @@ module Types Gitlab::Graphql::Loaders::BatchModelLoader.new(Issue, object.duplicated_to_id).find end + def related_merge_requests + # rubocop: disable CodeReuse/ActiveRecord + MergeRequest.where( + id: ::Issues::ReferencedMergeRequestsService.new(container: object.project, current_user: current_user) + .execute(object) + .first + .map(&:id) + ) + # rubocop: enable CodeReuse/ActiveRecord + end + def discussion_locked !!object.discussion_locked end @@ -190,10 +206,6 @@ module Types object.creatable_note_email_address(context[:current_user]) end - def hidden? - object.hidden? if Feature.enabled?(:ban_user_feature_flag) - end - def escalation_status object.supports_escalation? ? object.escalation_status&.status_name : nil end |