Show reactions to threads
This commit is contained in:
32
github.go
32
github.go
@@ -153,6 +153,10 @@ query ReviewThreadsPage($owner: String!, $name: String!, $number: Int!, $after:
|
||||
line startLine originalLine originalStartLine
|
||||
originalCommit { oid }
|
||||
author { login }
|
||||
reactionGroups {
|
||||
content viewerHasReacted
|
||||
reactors { totalCount }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,6 +176,10 @@ query ReviewCommentsPage($id: ID!, $after: String) {
|
||||
line startLine originalLine originalStartLine
|
||||
originalCommit { oid }
|
||||
author { login }
|
||||
reactionGroups {
|
||||
content viewerHasReacted
|
||||
reactors { totalCount }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,6 +382,10 @@ query PullRequestDetails($owner: String!, $name: String!, $number: Int!) {
|
||||
line startLine originalLine originalStartLine
|
||||
originalCommit { oid }
|
||||
author { login }
|
||||
reactionGroups {
|
||||
content viewerHasReacted
|
||||
reactors { totalCount }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -484,6 +496,15 @@ type githubReviewComment struct {
|
||||
OriginalCommit *struct{ OID string }
|
||||
CreatedAt time.Time
|
||||
Author *githubActor
|
||||
ReactionGroups []githubReactionGroup
|
||||
}
|
||||
|
||||
type githubReactionGroup struct {
|
||||
Content string
|
||||
ViewerHasReacted bool
|
||||
Reactors struct {
|
||||
TotalCount int
|
||||
}
|
||||
}
|
||||
|
||||
type githubReviewCommentConnection struct {
|
||||
@@ -1196,13 +1217,22 @@ func convertReviewThread(thread githubReviewThread) ReviewThread {
|
||||
}
|
||||
|
||||
func convertReviewComment(comment githubReviewComment) ReviewComment {
|
||||
return ReviewComment{
|
||||
item := ReviewComment{
|
||||
ID: comment.ID, Author: actorLogin(comment.Author), Body: comment.Body,
|
||||
DiffHunk: comment.DiffHunk, CreatedAt: comment.CreatedAt, URL: comment.URL,
|
||||
Line: intValue(comment.Line), StartLine: intValue(comment.StartLine),
|
||||
OriginalLine: intValue(comment.OriginalLine), OriginalStartLine: intValue(comment.OriginalStartLine),
|
||||
OriginalCommitOID: commitOID(comment.OriginalCommit), Outdated: comment.Outdated,
|
||||
}
|
||||
for _, group := range comment.ReactionGroups {
|
||||
if group.Reactors.TotalCount > 0 {
|
||||
item.Reactions = append(item.Reactions, ReactionSummary{
|
||||
Content: group.Content, Count: group.Reactors.TotalCount,
|
||||
ViewerHasReacted: group.ViewerHasReacted,
|
||||
})
|
||||
}
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
||||
func actorLogin(actor *githubActor) string {
|
||||
|
||||
Reference in New Issue
Block a user