@@ -444,6 +444,7 @@ func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, err
444444 Labels : labels ,
445445 Assignees : assignees ,
446446 IsLocked : issue .IsLocked ,
447+ Context : base .BasicIssueContext (issue .Index ),
447448 })
448449 }
449450
@@ -466,26 +467,26 @@ func (g *GiteaDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comm
466467 default :
467468 }
468469
469- comments , _ , err := g .client .ListIssueComments (g .repoOwner , g .repoName , opts .IssueNumber , gitea_sdk.ListIssueCommentOptions {ListOptions : gitea_sdk.ListOptions {
470+ comments , _ , err := g .client .ListIssueComments (g .repoOwner , g .repoName , opts .Context . ForeignID () , gitea_sdk.ListIssueCommentOptions {ListOptions : gitea_sdk.ListOptions {
470471 // PageSize: g.maxPerPage,
471472 // Page: i,
472473 }})
473474 if err != nil {
474- return nil , false , fmt .Errorf ("error while listing comments for issue #%d. Error: %v" , opts .IssueNumber , err )
475+ return nil , false , fmt .Errorf ("error while listing comments for issue #%d. Error: %v" , opts .Context . ForeignID () , err )
475476 }
476477
477478 for _ , comment := range comments {
478479 reactions , err := g .getCommentReactions (comment .ID )
479480 if err != nil {
480- log .Warn ("Unable to load comment reactions during migrating issue #%d for comment %d to %s/%s. Error: %v" , opts .IssueNumber , comment .ID , g .repoOwner , g .repoName , err )
481+ log .Warn ("Unable to load comment reactions during migrating issue #%d for comment %d to %s/%s. Error: %v" , opts .Context . ForeignID () , comment .ID , g .repoOwner , g .repoName , err )
481482 if err2 := models .CreateRepositoryNotice (
482- fmt .Sprintf ("Unable to load reactions during migrating issue #%d for comment %d to %s/%s. Error: %v" , opts .IssueNumber , comment .ID , g .repoOwner , g .repoName , err )); err2 != nil {
483+ fmt .Sprintf ("Unable to load reactions during migrating issue #%d for comment %d to %s/%s. Error: %v" , opts .Context . ForeignID () , comment .ID , g .repoOwner , g .repoName , err )); err2 != nil {
483484 log .Error ("create repository notice failed: " , err2 )
484485 }
485486 }
486487
487488 allComments = append (allComments , & base.Comment {
488- IssueIndex : opts .IssueNumber ,
489+ IssueIndex : opts .Context . LocalID () ,
489490 PosterID : comment .Poster .ID ,
490491 PosterName : comment .Poster .UserName ,
491492 PosterEmail : comment .Poster .Email ,
@@ -615,6 +616,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
615616 RepoName : g .repoName ,
616617 OwnerName : g .repoOwner ,
617618 },
619+ Context : base .BasicIssueContext (pr .Index ),
618620 })
619621 }
620622
@@ -626,7 +628,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
626628}
627629
628630// GetReviews returns pull requests review
629- func (g * GiteaDownloader ) GetReviews (index int64 ) ([]* base.Review , error ) {
631+ func (g * GiteaDownloader ) GetReviews (context base. IssueContext ) ([]* base.Review , error ) {
630632 if err := g .client .CheckServerVersionConstraint (">=1.12" ); err != nil {
631633 log .Info ("GiteaDownloader: instance to old, skip GetReviews" )
632634 return nil , nil
@@ -642,7 +644,7 @@ func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error) {
642644 default :
643645 }
644646
645- prl , _ , err := g .client .ListPullReviews (g .repoOwner , g .repoName , index , gitea_sdk.ListPullReviewsOptions {ListOptions : gitea_sdk.ListOptions {
647+ prl , _ , err := g .client .ListPullReviews (g .repoOwner , g .repoName , context . ForeignID () , gitea_sdk.ListPullReviewsOptions {ListOptions : gitea_sdk.ListOptions {
646648 Page : i ,
647649 PageSize : g .maxPerPage ,
648650 }})
@@ -652,7 +654,7 @@ func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error) {
652654
653655 for _ , pr := range prl {
654656
655- rcl , _ , err := g .client .ListPullReviewComments (g .repoOwner , g .repoName , index , pr .ID )
657+ rcl , _ , err := g .client .ListPullReviewComments (g .repoOwner , g .repoName , context . ForeignID () , pr .ID )
656658 if err != nil {
657659 return nil , err
658660 }
@@ -678,7 +680,7 @@ func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error) {
678680
679681 allReviews = append (allReviews , & base.Review {
680682 ID : pr .ID ,
681- IssueIndex : index ,
683+ IssueIndex : context . LocalID () ,
682684 ReviewerID : pr .Reviewer .ID ,
683685 ReviewerName : pr .Reviewer .UserName ,
684686 Official : pr .Official ,
0 commit comments