feat(sidebar): add last activity task sorting (#2762)
This commit is contained in:
@@ -426,7 +426,7 @@ func convertBatchedPRResult(raw *batchedPRResult, owner, repo string, number int
|
||||
reviewState := summarizeReviewState(raw.Reviews.Nodes)
|
||||
checksState := ""
|
||||
if len(raw.Commits.Nodes) > 0 && raw.Commits.Nodes[0].Commit.StatusCheckRollup != nil {
|
||||
checksState = strings.ToLower(raw.Commits.Nodes[0].Commit.StatusCheckRollup.State)
|
||||
checksState = normalizeGraphQLCheckRollupState(raw.Commits.Nodes[0].Commit.StatusCheckRollup.State)
|
||||
}
|
||||
unresolved := 0
|
||||
for _, t := range raw.ReviewThreads.Nodes {
|
||||
@@ -447,6 +447,23 @@ func convertBatchedPRResult(raw *batchedPRResult, owner, repo string, number int
|
||||
}
|
||||
}
|
||||
|
||||
// normalizeGraphQLCheckRollupState converts GitHub's GraphQL status-rollup
|
||||
// enum to the smaller contract shared by REST and TaskPR persistence.
|
||||
func normalizeGraphQLCheckRollupState(raw string) string {
|
||||
switch strings.ToLower(strings.TrimSpace(raw)) {
|
||||
case "":
|
||||
return ""
|
||||
case checkStatusSuccess:
|
||||
return checkStatusSuccess
|
||||
case checkConclusionFail, "error":
|
||||
return checkConclusionFail
|
||||
case "expected", checkStatusPending:
|
||||
return checkStatusPending
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// reviewNodesToSamples converts the GraphQL reviewNode shape to the shared
|
||||
// reviewSample slice used by the dedup helpers in client_helpers.go.
|
||||
func reviewNodesToSamples(nodes []reviewNode) []reviewSample {
|
||||
|
||||
Reference in New Issue
Block a user