debian-mirror-gitlab/app/graphql/resolvers/issue_status_counts_resolver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
823 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
module Resolvers
2023-01-13 00:05:48 +05:30
class IssueStatusCountsResolver < Issues::BaseResolver
2020-10-24 23:57:45 +05:30
type Types::IssueStatusCountsType, null: true
2023-01-13 00:05:48 +05:30
2021-12-11 22:18:48 +05:30
accept_release_tag
2020-10-24 23:57:45 +05:30
2023-01-13 00:05:48 +05:30
def resolve(**args)
return Issue.none if resource_parent.nil?
finder = IssuesFinder.new(current_user, prepare_finder_params(args))
finder.parent_param = resource_parent
Gitlab::IssuablesCountForState.new(finder, resource_parent)
end
private
2021-02-22 17:27:13 +05:30
2023-01-13 00:05:48 +05:30
def resource_parent
# The project could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project to query for issues, so
# make sure it's loaded and not `nil` before continuing.
strong_memoize(:resource_parent) do
object.respond_to?(:sync) ? object.sync : object
end
2020-10-24 23:57:45 +05:30
end
end
end