From 2fd6e36b79c6b6c5b7480f094fdad62a175d77cc Mon Sep 17 00:00:00 2001 From: Chris Lemaire Date: Thu, 14 Nov 2024 16:43:46 +0100 Subject: [PATCH] [github] Only gather totalCount for pending reviews GitOrigin-RevId: 9aa62ec7c0bb079ad5882cd71df395820ba68de1 --- .../fragment/pullRequestPendingReview.graphql | 13 +++++-------- .../pullrequest/GHPullRequestPendingReviewDTO.kt | 12 +++++++----- .../data/provider/GHPRReviewDataProviderImplTest.kt | 3 +-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/plugins/github/resources/graphql/fragment/pullRequestPendingReview.graphql b/plugins/github/resources/graphql/fragment/pullRequestPendingReview.graphql index 5830a6a8fd03..93cfe9fd168c 100644 --- a/plugins/github/resources/graphql/fragment/pullRequestPendingReview.graphql +++ b/plugins/github/resources/graphql/fragment/pullRequestPendingReview.graphql @@ -1,10 +1,7 @@ fragment pullRequestPendingReview on PullRequestReview { - ...nodeInfo - state - comments(first: 0) { - nodes { - ...pullRequestReviewComment - } - totalCount - } + ...nodeInfo + state + comments(first: 0) { + totalCount + } } \ No newline at end of file diff --git a/plugins/github/src/org/jetbrains/plugins/github/api/data/pullrequest/GHPullRequestPendingReviewDTO.kt b/plugins/github/src/org/jetbrains/plugins/github/api/data/pullrequest/GHPullRequestPendingReviewDTO.kt index e0cf358980fd..6ad6fc0206d4 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/api/data/pullrequest/GHPullRequestPendingReviewDTO.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/api/data/pullrequest/GHPullRequestPendingReviewDTO.kt @@ -2,11 +2,13 @@ package org.jetbrains.plugins.github.api.data.pullrequest import com.intellij.collaboration.api.dto.GraphQLFragment -import com.intellij.collaboration.api.dto.GraphQLNodesDTO import org.jetbrains.plugins.github.api.data.GHNode @GraphQLFragment("/graphql/fragment/pullRequestPendingReview.graphql") -class GHPullRequestPendingReviewDTO(id: String, - val state: GHPullRequestReviewState, - val comments: GraphQLNodesDTO) - : GHNode(id) \ No newline at end of file +class GHPullRequestPendingReviewDTO( + id: String, + val state: GHPullRequestReviewState, + val comments: CommentCount, +) : GHNode(id) { + data class CommentCount(val totalCount: Int) +} \ No newline at end of file diff --git a/plugins/github/test/org/jetbrains/plugins/github/pullrequest/data/provider/GHPRReviewDataProviderImplTest.kt b/plugins/github/test/org/jetbrains/plugins/github/pullrequest/data/provider/GHPRReviewDataProviderImplTest.kt index 8514ef9866f7..df9ef0eaa590 100644 --- a/plugins/github/test/org/jetbrains/plugins/github/pullrequest/data/provider/GHPRReviewDataProviderImplTest.kt +++ b/plugins/github/test/org/jetbrains/plugins/github/pullrequest/data/provider/GHPRReviewDataProviderImplTest.kt @@ -1,7 +1,6 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.github.pullrequest.data.provider -import com.intellij.collaboration.api.dto.GraphQLNodesDTO import com.intellij.collaboration.util.MainDispatcherRule import com.intellij.util.messages.MessageBus import io.mockk.* @@ -41,7 +40,7 @@ class GHPRReviewDataProviderImplTest { GHPRReviewDataProviderImpl(backgroundScope, reviewService, mockk(), PR_ID, messageBus) private fun createPendingReview(id: String, comments: List): GHPullRequestPendingReviewDTO = - GHPullRequestPendingReviewDTO(id, GHPullRequestReviewState.PENDING, GraphQLNodesDTO(comments, comments.size)) + GHPullRequestPendingReviewDTO(id, GHPullRequestReviewState.PENDING, GHPullRequestPendingReviewDTO.CommentCount(comments.size)) @Test fun testCachingReviewLoad() = runTest {