Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84d31bc

Browse files
authored
A small refactor to use context in the service layer (#35179)
1 parentc3f5ea3 commit84d31bc

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

‎routers/web/repo/pull.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ func GetPullCommits(ctx *context.Context) {
581581
}
582582
resp:=&pullCommitList{}
583583

584-
commits,lastReviewCommitSha,err:=pull_service.GetPullCommits(ctx,issue)
584+
commits,lastReviewCommitSha,err:=pull_service.GetPullCommits(ctx,ctx.Repo.GitRepo,ctx.Doer,issue)
585585
iferr!=nil {
586586
ctx.JSON(http.StatusInternalServerError,err)
587587
return

‎services/pull/pull.go‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
repo_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"
3736
issue_service"code.gitea.io/gitea/services/issue"
3837
notify_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-
funcGetPullCommits(ctx*gitea_context.Context,issue*issues_model.Issue) ([]CommitInfo,string,error) {
1067+
funcGetPullCommits(ctxcontext.Context,baseGitRepo*git.Repository,doer*user_model.User,issue*issues_model.Issue) ([]CommitInfo,string,error) {
10691068
pull:=issue.PullRequest
10701069

1071-
baseGitRepo:=ctx.Repo.GitRepo
1072-
10731070
iferr:=pull.LoadBaseRepo(ctx);err!=nil {
10741071
returnnil,"",err
10751072
}
@@ -1105,11 +1102,11 @@ func GetPullCommits(ctx *gitea_context.Context, issue *issues_model.Issue) ([]Co
11051102
}
11061103

11071104
varlastReviewCommitIDstring
1108-
ifctx.IsSigned {
1105+
ifdoer!=nil {
11091106
// get last review of current user and store information in context (if available)
11101107
lastreview,err:=issues_model.FindLatestReviews(ctx, issues_model.FindReviewOptions{
11111108
IssueID:issue.ID,
1112-
ReviewerID:ctx.Doer.ID,
1109+
ReviewerID:doer.ID,
11131110
Types: []issues_model.ReviewType{
11141111
issues_model.ReviewTypeApprove,
11151112
issues_model.ReviewTypeComment,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp