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

githubapi: Add note about inline comment OriginalPosition.
dmitshur committed 6 years ago commit 65cd269c08f65833635ffa2e2d97cfc0460b1e11
Collapse all
githubapi/githubapi.go
@@ -365,11 +365,11 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
						ViewerCanUpdate bool
						Comments        struct {
							Nodes []struct {
								DatabaseID       uint64
								Path             string
								OriginalPosition int
								OriginalPosition int // The original line index in the diff to which the comment applies.
								Body             string
								ReactionGroups   reactionGroups
							}
						} `graphql:"comments(first:100)"` // TODO: Pagination... Figure out how to make pagination across 2 resource types work...
					}
@@ -444,11 +444,11 @@ 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{
				ID:        fmt.Sprintf("rc%d", comment.DatabaseID),
				File:      comment.Path,
				Line:      comment.OriginalPosition,
				Line:      comment.OriginalPosition, // TODO: This isn't line in file, it's line *in the diff*. Take it into account, compute real line, etc.
				Body:      comment.Body,
				Reactions: ghReactions(comment.ReactionGroups, ghUser(&q.Viewer)),
			})
		}
		sort.Slice(cs, func(i, j int) bool {