dmitri.shuralyov.com/service/change/...

Add reactions to InlineComment.
dmitshur committed 6 years ago commit 0005e9ba28e36d2df62c0e702668d1159f1fddcb
Collapse all
githubapi/githubapi.go
@@ -353,13 +353,15 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
						State           githubql.PullRequestReviewState
						Body            string
						ViewerCanUpdate bool
						Comments        struct {
							Nodes []struct {
								DatabaseID       uint64
								Path             string
								OriginalPosition int
								Body             string
								ReactionGroups   reactionGroups
							}
						} `graphql:"comments(first:100)"` // TODO: Pagination... Figure out how to make pagination across 2 resource types work...
					}
				} `graphql:"reviews(first:100)"` // TODO: Pagination... Figure out how to make pagination across 2 resource types work...
			} `graphql:"pullRequest(number:$prNumber)"`
@@ -425,13 +427,15 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
			}
		}
		var cs []change.InlineComment
		for _, comment := range review.Comments.Nodes {
			cs = append(cs, change.InlineComment{
				File: comment.Path,
				Line: comment.OriginalPosition,
				Body: comment.Body,
				ID:        comment.DatabaseID,
				File:      comment.Path,
				Line:      comment.OriginalPosition,
				Body:      comment.Body,
				Reactions: s.reactions(comment.ReactionGroups),
			})
		}
		sort.Slice(cs, func(i, j int) bool {
			if cs[i].File == cs[j].File {
				return cs[i].Line < cs[j].Line
timeline.go
@@ -39,13 +39,15 @@ type Review struct {
	Comments  []InlineComment
}

// InlineComment represents an inline comment that was left as part of a review.
type InlineComment struct {
	File string
	Line int
	Body string
	ID        uint64
	File      string
	Line      int
	Body      string
	Reactions []reactions.Reaction
}

type ReviewState int8

const (