forked from forgejo/forgejo
Add context.Context
to more methods (#21546)
This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
fefdb7ffd1
commit
044c754ea5
148 changed files with 1411 additions and 1564 deletions
|
@ -38,12 +38,12 @@ func NewIssue(repo *repo_model.Repository, issue *issues_model.Issue, labelIDs [
|
|||
return err
|
||||
}
|
||||
|
||||
notification.NotifyNewIssue(issue, mentions)
|
||||
notification.NotifyNewIssue(db.DefaultContext, issue, mentions)
|
||||
if len(issue.Labels) > 0 {
|
||||
notification.NotifyIssueChangeLabels(issue.Poster, issue, issue.Labels, nil)
|
||||
notification.NotifyIssueChangeLabels(db.DefaultContext, issue.Poster, issue, issue.Labels, nil)
|
||||
}
|
||||
if issue.Milestone != nil {
|
||||
notification.NotifyIssueChangeMilestone(issue.Poster, issue, 0)
|
||||
notification.NotifyIssueChangeMilestone(db.DefaultContext, issue.Poster, issue, 0)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -58,7 +58,7 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string)
|
|||
return
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeTitle(doer, issue, oldTitle)
|
||||
notification.NotifyIssueChangeTitle(db.DefaultContext, doer, issue, oldTitle)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func ChangeIssueRef(issue *issues_model.Issue, doer *user_model.User, ref string
|
|||
return err
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeRef(doer, issue, oldRef)
|
||||
notification.NotifyIssueChangeRef(db.DefaultContext, doer, issue, oldRef)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ func UpdateAssignees(issue *issues_model.Issue, oneAssignee string, multipleAssi
|
|||
// DeleteIssue deletes an issue
|
||||
func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue) error {
|
||||
// load issue before deleting it
|
||||
if err := issue.LoadAttributes(db.DefaultContext); err != nil {
|
||||
if err := issue.LoadAttributes(gitRepo.Ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := issue.LoadPullRequest(); err != nil {
|
||||
if err := issue.LoadPullRequest(gitRepo.Ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
|
|||
}
|
||||
}
|
||||
|
||||
notification.NotifyDeleteIssue(doer, issue)
|
||||
notification.NotifyDeleteIssue(gitRepo.Ctx, doer, issue)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
|
|||
// AddAssigneeIfNotAssigned adds an assignee only if he isn't already assigned to the issue.
|
||||
// Also checks for access of assigned user
|
||||
func AddAssigneeIfNotAssigned(issue *issues_model.Issue, doer *user_model.User, assigneeID int64) (err error) {
|
||||
assignee, err := user_model.GetUserByID(assigneeID)
|
||||
assignee, err := user_model.GetUserByIDCtx(db.DefaultContext, assigneeID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue