|
|
|
@ -459,7 +459,7 @@ func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, err
|
|
|
|
|
func (g *GiteaDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comment, bool, error) {
|
|
|
|
|
var allComments = make([]*base.Comment, 0, g.maxPerPage)
|
|
|
|
|
|
|
|
|
|
// for i := 1; ; i++ {
|
|
|
|
|
for i := 1; ; i++ {
|
|
|
|
|
// make sure gitea can shutdown gracefully
|
|
|
|
|
select {
|
|
|
|
|
case <-g.ctx.Done():
|
|
|
|
@ -468,8 +468,8 @@ func (g *GiteaDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comm
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
comments, _, err := g.client.ListIssueComments(g.repoOwner, g.repoName, opts.Context.ForeignID(), gitea_sdk.ListIssueCommentOptions{ListOptions: gitea_sdk.ListOptions{
|
|
|
|
|
// PageSize: g.maxPerPage,
|
|
|
|
|
// Page: i,
|
|
|
|
|
PageSize: g.maxPerPage,
|
|
|
|
|
Page: i,
|
|
|
|
|
}})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, false, fmt.Errorf("error while listing comments for issue #%d. Error: %v", opts.Context.ForeignID(), err)
|
|
|
|
@ -497,11 +497,10 @@ func (g *GiteaDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comm
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO enable pagination vor (gitea >= 1.14) when it got implemented
|
|
|
|
|
// if !g.pagination || len(comments) < g.maxPerPage {
|
|
|
|
|
// break
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
if !g.pagination || len(comments) < g.maxPerPage {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return allComments, true, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|