[github] Only gather totalCount for pending reviews

GitOrigin-RevId: 9aa62ec7c0bb079ad5882cd71df395820ba68de1
This commit is contained in:
Chris Lemaire
2024-11-29 17:44:52 +00:00
committed by intellij-monorepo-bot
parent e4e1e56b64
commit 2fd6e36b79
3 changed files with 13 additions and 15 deletions
@@ -1,10 +1,7 @@
fragment pullRequestPendingReview on PullRequestReview {
...nodeInfo
state
comments(first: 0) {
nodes {
...pullRequestReviewComment
}
totalCount
}
...nodeInfo
state
comments(first: 0) {
totalCount
}
}
@@ -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<GHPullRequestReviewComment>)
: GHNode(id)
class GHPullRequestPendingReviewDTO(
id: String,
val state: GHPullRequestReviewState,
val comments: CommentCount,
) : GHNode(id) {
data class CommentCount(val totalCount: Int)
}
@@ -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<GHPullRequestReviewComment>): GHPullRequestPendingReviewDTO =
GHPullRequestPendingReviewDTO(id, GHPullRequestReviewState.PENDING, GraphQLNodesDTO(comments, comments.size))
GHPullRequestPendingReviewDTO(id, GHPullRequestReviewState.PENDING, GHPullRequestPendingReviewDTO.CommentCount(comments.size))
@Test
fun testCachingReviewLoad() = runTest {