Skip to content

Commit 1c8b8ef

Browse files
committed
Add comments
1 parent e7b9e02 commit 1c8b8ef

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

services/migrations/github.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
502502
return g.getAllCommentsSince(page, perPage, nil)
503503
}
504504

505+
// GetAllCommentsSince returns repository comments since a time.
506+
// If since is nil, it will return all comments.
505507
func (g *GithubDownloaderV3) getAllCommentsSince(page, perPage int, since *time.Time) ([]*base.Comment, bool, error) {
506508
var (
507509
allComments = make([]*base.Comment, 0, perPage)
@@ -579,7 +581,8 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq
579581
return g.GetNewPullRequests(page, perPage, time.Time{})
580582
}
581583

582-
func convertGithubReview(r *github.PullRequestReview) *base.Review {
584+
// convertGithubReview converts github review to Gitea review
585+
func (g *GithubDownloaderV3) convertGithubReview(r *github.PullRequestReview) *base.Review {
583586
return &base.Review{
584587
ID: r.GetID(),
585588
ReviewerID: r.GetUser().GetID(),
@@ -655,7 +658,7 @@ func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Rev
655658
}
656659
g.setRate(&resp.Rate)
657660
for _, review := range reviews {
658-
r := convertGithubReview(review)
661+
r := g.convertGithubReview(review)
659662
r.IssueIndex = reviewable.GetLocalIndex()
660663
// retrieve all review comments
661664
opt2 := &github.ListOptions{
@@ -717,7 +720,8 @@ func (g *GithubDownloaderV3) GetNewIssues(page, perPage int, updatedAfter time.T
717720
return g.getIssuesSince(page, perPage, updatedAfter)
718721
}
719722

720-
// getIssuesSince returns issues given page, perPage and since
723+
// getIssuesSince returns issues given page, perPage and since.
724+
// when since is empty, it will return all issues
721725
func (g *GithubDownloaderV3) getIssuesSince(page, perPage int, since time.Time) ([]*base.Issue, bool, error) {
722726
if perPage > g.maxPerPage {
723727
perPage = g.maxPerPage
@@ -899,6 +903,7 @@ func (g *GithubDownloaderV3) convertGithubPullRequest(pr *github.PullRequest, pe
899903
}, nil
900904
}
901905

906+
// getIssueReactions returns reactions using Github API
902907
func (g *GithubDownloaderV3) getIssueReactions(number, perPage int) ([]*base.Reaction, error) {
903908
var reactions []*base.Reaction
904909
if !g.SkipReactions {

0 commit comments

Comments
 (0)