diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /app/graphql/types/issue_type.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/graphql/types/issue_type.rb')
-rw-r--r-- | app/graphql/types/issue_type.rb | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 49c84f75e1a..83b8a834801 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -61,9 +61,11 @@ module Types field :downvotes, GraphQL::INT_TYPE, null: false, description: 'Number of downvotes the issue has received' field :user_notes_count, GraphQL::INT_TYPE, null: false, - description: 'Number of user notes of the issue' + description: 'Number of user notes of the issue', + resolver: Resolvers::UserNotesCountResolver field :user_discussions_count, GraphQL::INT_TYPE, null: false, - description: 'Number of user discussions in the issue' + description: 'Number of user discussions in the issue', + resolver: Resolvers::UserDiscussionsCountResolver field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path, description: 'Web path of the issue' field :web_url, GraphQL::STRING_TYPE, null: false, @@ -119,26 +121,6 @@ module Types field :moved_to, Types::IssueType, null: true, description: 'Updated Issue after it got moved to another project' - def user_notes_count - BatchLoader::GraphQL.for(object.id).batch(key: :issue_user_notes_count) do |ids, loader, args| - counts = Note.count_for_collection(ids, 'Issue').index_by(&:noteable_id) - - ids.each do |id| - loader.call(id, counts[id]&.count || 0) - end - end - end - - def user_discussions_count - BatchLoader::GraphQL.for(object.id).batch(key: :issue_user_discussions_count) do |ids, loader, args| - counts = Note.count_for_collection(ids, 'Issue', 'COUNT(DISTINCT discussion_id) as count').index_by(&:noteable_id) - - ids.each do |id| - loader.call(id, counts[id]&.count || 0) - end - end - end - def author Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find end |