mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -1007,7 +1007,7 @@ func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull
|
||||
|
||||
// Check if the passed assignees actually exists and is assignable
|
||||
for _, aID := range assigneeIDs {
|
||||
assignee, err := user_model.GetUserByID(aID)
|
||||
assignee, err := user_model.GetUserByID(ctx, aID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserByID", err)
|
||||
return nil, nil, 0, 0
|
||||
@@ -1679,7 +1679,7 @@ func ViewIssue(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["DefaultSquashMergeMessage"] = defaultSquashMergeMessage
|
||||
|
||||
if err = pull.LoadProtectedBranch(); err != nil {
|
||||
if err = pull.LoadProtectedBranch(ctx); err != nil {
|
||||
ctx.ServerError("LoadProtectedBranch", err)
|
||||
return
|
||||
}
|
||||
@@ -2062,7 +2062,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
default:
|
||||
assignee, err := user_model.GetUserByID(assigneeID)
|
||||
assignee, err := user_model.GetUserByID(ctx, assigneeID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserByID", err)
|
||||
return
|
||||
@@ -2173,7 +2173,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
|
||||
continue
|
||||
}
|
||||
|
||||
reviewer, err := user_model.GetUserByID(reviewID)
|
||||
reviewer, err := user_model.GetUserByID(ctx, reviewID)
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
log.Warn(
|
||||
@@ -3027,7 +3027,7 @@ func filterXRefComments(ctx *context.Context, issue *issues_model.Issue) error {
|
||||
if issues_model.CommentTypeIsRef(c.Type) && c.RefRepoID != issue.RepoID && c.RefRepoID != 0 {
|
||||
var err error
|
||||
// Set RefRepo for description in template
|
||||
c.RefRepo, err = repo_model.GetRepositoryByID(c.RefRepoID)
|
||||
c.RefRepo, err = repo_model.GetRepositoryByID(ctx, c.RefRepoID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user