@@ -33,7 +33,6 @@ import (
3333repo_module"code.gitea.io/gitea/modules/repository"
3434"code.gitea.io/gitea/modules/setting"
3535"code.gitea.io/gitea/modules/util"
36- gitea_context"code.gitea.io/gitea/services/context"
3736issue_service"code.gitea.io/gitea/services/issue"
3837notify_service"code.gitea.io/gitea/services/notify"
3938)
@@ -1065,11 +1064,9 @@ type CommitInfo struct {
10651064// GetPullCommits returns all commits on given pull request and the last review commit sha
10661065// Attention: The last review commit sha must be from the latest review whose commit id is not empty.
10671066// So the type of the latest review cannot be "ReviewTypeRequest".
1068- func GetPullCommits (ctx * gitea_context .Context ,issue * issues_model.Issue ) ([]CommitInfo ,string ,error ) {
1067+ func GetPullCommits (ctx context .Context , baseGitRepo * git. Repository , doer * user_model. User ,issue * issues_model.Issue ) ([]CommitInfo ,string ,error ) {
10691068pull := issue .PullRequest
10701069
1071- baseGitRepo := ctx .Repo .GitRepo
1072-
10731070if err := pull .LoadBaseRepo (ctx );err != nil {
10741071return nil ,"" ,err
10751072}
@@ -1105,11 +1102,11 @@ func GetPullCommits(ctx *gitea_context.Context, issue *issues_model.Issue) ([]Co
11051102}
11061103
11071104var lastReviewCommitID string
1108- if ctx . IsSigned {
1105+ if doer != nil {
11091106// get last review of current user and store information in context (if available)
11101107lastreview ,err := issues_model .FindLatestReviews (ctx , issues_model.FindReviewOptions {
11111108IssueID :issue .ID ,
1112- ReviewerID :ctx . Doer .ID ,
1109+ ReviewerID :doer .ID ,
11131110Types : []issues_model.ReviewType {
11141111issues_model .ReviewTypeApprove ,
11151112issues_model .ReviewTypeComment ,