(ctx context.Context, item *timelineItem)
| 196 | } |
| 197 | |
| 198 | func (mm *importMediator) fillCommentEdits(ctx context.Context, item *timelineItem) { |
| 199 | // Here we are only concerned with timeline items of type issueComment. |
| 200 | if item.Typename != "IssueComment" { |
| 201 | return |
| 202 | } |
| 203 | // First: setup message handling while submitting GraphQL queries. |
| 204 | comment := &item.IssueComment |
| 205 | edits := &comment.UserContentEdits |
| 206 | hasEdits := true |
| 207 | for hasEdits { |
| 208 | for edit := range reverse(edits.Nodes) { |
| 209 | if edit.Diff == nil || string(*edit.Diff) == "" { |
| 210 | // issueEdit.Diff == nil happen if the event is older than early |
| 211 | // 2018, Github doesn't have the data before that. Best we can do is |
| 212 | // to ignore the event. |
| 213 | continue |
| 214 | } |
| 215 | select { |
| 216 | case <-ctx.Done(): |
| 217 | return |
| 218 | case mm.importEvents <- CommentEditEvent{commentId: comment.Id, userContentEdit: edit}: |
| 219 | } |
| 220 | } |
| 221 | if !edits.PageInfo.HasPreviousPage { |
| 222 | break |
| 223 | } |
| 224 | edits, hasEdits = mm.queryCommentEdits(ctx, comment.Id, edits.PageInfo.EndCursor) |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | func (mm *importMediator) queryCommentEdits(ctx context.Context, nid githubv4.ID, cursor githubv4.String) (*userContentEditConnection, bool) { |
| 229 | vars := newCommentEditVars() |
no test coverage detected