aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-11-11 21:00:57 +0100
committerGitHub <noreply@github.com>2019-11-11 21:00:57 +0100
commit2367029124afb363bb42b9089f43e62bc8e04ae3 (patch)
tree0853693bff87b8abdf2f1ad7b9aa63046aaaf331
parent6a1c8c4dd45c8602e67d6ccbb51165a3c5b073d2 (diff)
parentc1f33db2f2fa557afefc29fc5427f7a0a5835e3a (diff)
downloadgit-bug-2367029124afb363bb42b9089f43e62bc8e04ae3.tar.gz
Merge pull request #248 from MichaelMure/github-deprecated
github: follow API changes
-rw-r--r--bridge/github/import_query.go4
-rw-r--r--bridge/github/iterator.go38
2 files changed, 21 insertions, 21 deletions
diff --git a/bridge/github/import_query.go b/bridge/github/import_query.go
index 62d3227b..f5cad299 100644
--- a/bridge/github/import_query.go
+++ b/bridge/github/import_query.go
@@ -102,13 +102,13 @@ type issueTimeline struct {
Body githubv4.String
Url githubv4.URI
- Timeline struct {
+ TimelineItems struct {
Edges []struct {
Cursor githubv4.String
Node timelineItem
}
PageInfo pageInfo
- } `graphql:"timeline(first: $timelineFirst, after: $timelineAfter)"`
+ } `graphql:"timelineItems(first: $timelineFirst, after: $timelineAfter)"`
UserContentEdits struct {
Nodes []userContentEdit
diff --git a/bridge/github/iterator.go b/bridge/github/iterator.go
index b878b5ca..f8e41993 100644
--- a/bridge/github/iterator.go
+++ b/bridge/github/iterator.go
@@ -138,9 +138,9 @@ func (i *iterator) initCommentEditQueryVariables() {
func (i *iterator) reverseTimelineEditNodes() {
node := i.timeline.query.Repository.Issues.Nodes[0]
reverseEdits(node.UserContentEdits.Nodes)
- for index, ce := range node.Timeline.Edges {
- if ce.Node.Typename == "IssueComment" && len(node.Timeline.Edges) != 0 {
- reverseEdits(node.Timeline.Edges[index].Node.IssueComment.UserContentEdits.Nodes)
+ for index, ce := range node.TimelineItems.Edges {
+ if ce.Node.Typename == "IssueComment" && len(node.TimelineItems.Edges) != 0 {
+ reverseEdits(node.TimelineItems.Edges[index].Node.IssueComment.UserContentEdits.Nodes)
}
}
}
@@ -194,7 +194,7 @@ func (i *iterator) NextIssue() bool {
i.timeline.variables["issueAfter"] = issues.PageInfo.EndCursor
i.timeline.index = -1
- timelineEndCursor := issues.Nodes[0].Timeline.PageInfo.EndCursor
+ timelineEndCursor := issues.Nodes[0].TimelineItems.PageInfo.EndCursor
// store cursor for future use
i.timeline.lastEndCursor = timelineEndCursor
@@ -219,25 +219,25 @@ func (i *iterator) NextTimelineItem() bool {
return false
}
- timeline := i.timeline.query.Repository.Issues.Nodes[0].Timeline
- // after NextIssue call it's good to check wether we have some timeline items or not
- if len(timeline.Edges) == 0 {
+ timelineItems := i.timeline.query.Repository.Issues.Nodes[0].TimelineItems
+ // after NextIssue call it's good to check wether we have some timelineItems items or not
+ if len(timelineItems.Edges) == 0 {
return false
}
- if i.timeline.index < len(timeline.Edges)-1 {
+ if i.timeline.index < len(timelineItems.Edges)-1 {
i.timeline.index++
return true
}
- if !timeline.PageInfo.HasNextPage {
+ if !timelineItems.PageInfo.HasNextPage {
return false
}
- i.timeline.lastEndCursor = timeline.PageInfo.EndCursor
+ i.timeline.lastEndCursor = timelineItems.PageInfo.EndCursor
// more timelines, query them
- i.timeline.variables["timelineAfter"] = timeline.PageInfo.EndCursor
+ i.timeline.variables["timelineAfter"] = timelineItems.PageInfo.EndCursor
ctx, cancel := context.WithTimeout(i.ctx, defaultTimeout)
defer cancel()
@@ -247,9 +247,9 @@ func (i *iterator) NextTimelineItem() bool {
return false
}
- timeline = i.timeline.query.Repository.Issues.Nodes[0].Timeline
- // (in case github returns something wierd) just for safety: better return a false than a panic
- if len(timeline.Edges) == 0 {
+ timelineItems = i.timeline.query.Repository.Issues.Nodes[0].TimelineItems
+ // (in case github returns something weird) just for safety: better return a false than a panic
+ if len(timelineItems.Edges) == 0 {
return false
}
@@ -260,8 +260,8 @@ func (i *iterator) NextTimelineItem() bool {
// TimelineItemValue return the actual timeline item value
func (i *iterator) TimelineItemValue() timelineItem {
- timeline := i.timeline.query.Repository.Issues.Nodes[0].Timeline
- return timeline.Edges[i.timeline.index].Node
+ timelineItems := i.timeline.query.Repository.Issues.Nodes[0].TimelineItems
+ return timelineItems.Edges[i.timeline.index].Node
}
func (i *iterator) queryIssueEdit() bool {
@@ -435,7 +435,7 @@ func (i *iterator) NextCommentEdit() bool {
return i.queryCommentEdit()
}
- commentEdits := i.timeline.query.Repository.Issues.Nodes[0].Timeline.Edges[i.timeline.index].Node.IssueComment
+ commentEdits := i.timeline.query.Repository.Issues.Nodes[0].TimelineItems.Edges[i.timeline.index].Node.IssueComment
// if there is no comment edits
if len(commentEdits.UserContentEdits.Nodes) == 0 {
return false
@@ -456,7 +456,7 @@ func (i *iterator) NextCommentEdit() bool {
if i.timeline.index == 0 {
i.commentEdit.variables["timelineAfter"] = i.timeline.lastEndCursor
} else {
- i.commentEdit.variables["timelineAfter"] = i.timeline.query.Repository.Issues.Nodes[0].Timeline.Edges[i.timeline.index-1].Cursor
+ i.commentEdit.variables["timelineAfter"] = i.timeline.query.Repository.Issues.Nodes[0].TimelineItems.Edges[i.timeline.index-1].Cursor
}
i.commentEdit.variables["commentEditBefore"] = commentEdits.UserContentEdits.PageInfo.StartCursor
@@ -470,7 +470,7 @@ func (i *iterator) CommentEditValue() userContentEdit {
return i.commentEdit.query.Repository.Issues.Nodes[0].Timeline.Nodes[0].IssueComment.UserContentEdits.Nodes[i.commentEdit.index]
}
- return i.timeline.query.Repository.Issues.Nodes[0].Timeline.Edges[i.timeline.index].Node.IssueComment.UserContentEdits.Nodes[i.timeline.commentEdit.index]
+ return i.timeline.query.Repository.Issues.Nodes[0].TimelineItems.Edges[i.timeline.index].Node.IssueComment.UserContentEdits.Nodes[i.timeline.commentEdit.index]
}
func reverseEdits(edits []userContentEdit) {