From 0c8f1c3a58c4707284cc6368af26715520a220c0 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Tue, 23 Jul 2019 18:40:10 +0200 Subject: bridge/gitlab: fix comment edition target hash in the import bridge/gitlab: global changes, typo fixes, comments addition --- bridge/gitlab/iterator.go | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'bridge/gitlab/iterator.go') diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go index 320f2a50..73f1614e 100644 --- a/bridge/gitlab/iterator.go +++ b/bridge/gitlab/iterator.go @@ -28,8 +28,8 @@ type iterator struct { // gitlab api v4 client gc *gitlab.Client - // if since is given the iterator will query only the updated - // issues after this date + // if since is given the iterator will query only the issues + // updated after this date since time.Time // project id @@ -79,8 +79,6 @@ func (i *iterator) Error() error { } func (i *iterator) getNextIssues() bool { - sort := "asc" - scope := "all" issues, _, err := i.gc.Issues.ListProjectIssues( i.project, &gitlab.ListProjectIssuesOptions{ @@ -88,9 +86,9 @@ func (i *iterator) getNextIssues() bool { Page: i.issue.page, PerPage: i.capacity, }, - Scope: &scope, + Scope: gitlab.String("all"), UpdatedAfter: &i.since, - Sort: &sort, + Sort: gitlab.String("asc"), }, ) @@ -114,15 +112,15 @@ func (i *iterator) getNextIssues() bool { } func (i *iterator) NextIssue() bool { + if i.err != nil { + return false + } + // first query if i.issue.cache == nil { return i.getNextIssues() } - if i.err != nil { - return false - } - // move cursor index if i.issue.index < len(i.issue.cache)-1 { i.issue.index++ @@ -137,8 +135,6 @@ func (i *iterator) IssueValue() *gitlab.Issue { } func (i *iterator) getNextNotes() bool { - sort := "asc" - order := "created_at" notes, _, err := i.gc.Notes.ListIssueNotes( i.project, i.IssueValue().IID, @@ -147,8 +143,8 @@ func (i *iterator) getNextNotes() bool { Page: i.note.page, PerPage: i.capacity, }, - Sort: &sort, - OrderBy: &order, + Sort: gitlab.String("asc"), + OrderBy: gitlab.String("created_at"), }, ) -- cgit