forked from forgejo/forgejo
Penultimate round of db.DefaultContext
refactor (#27414)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
50166d1f7c
commit
ebe803e514
136 changed files with 428 additions and 421 deletions
|
@ -38,11 +38,7 @@ func (issue *Issue) projectID(ctx context.Context) int64 {
|
|||
}
|
||||
|
||||
// ProjectBoardID return project board id if issue was assigned to one
|
||||
func (issue *Issue) ProjectBoardID() int64 {
|
||||
return issue.projectBoardID(db.DefaultContext)
|
||||
}
|
||||
|
||||
func (issue *Issue) projectBoardID(ctx context.Context) int64 {
|
||||
func (issue *Issue) ProjectBoardID(ctx context.Context) int64 {
|
||||
var ip project_model.ProjectIssue
|
||||
has, err := db.GetEngine(ctx).Where("issue_id=?", issue.ID).Get(&ip)
|
||||
if err != nil || !has {
|
||||
|
@ -100,8 +96,8 @@ func LoadIssuesFromBoardList(ctx context.Context, bs project_model.BoardList) (m
|
|||
}
|
||||
|
||||
// ChangeProjectAssign changes the project associated with an issue
|
||||
func ChangeProjectAssign(issue *Issue, doer *user_model.User, newProjectID int64) error {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
func ChangeProjectAssign(ctx context.Context, issue *Issue, doer *user_model.User, newProjectID int64) error {
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -156,8 +152,8 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.U
|
|||
}
|
||||
|
||||
// MoveIssueAcrossProjectBoards move a card from one board to another
|
||||
func MoveIssueAcrossProjectBoards(issue *Issue, board *project_model.Board) error {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
func MoveIssueAcrossProjectBoards(ctx context.Context, issue *Issue, board *project_model.Board) error {
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue