Skip to content

Commit 3a693bd

Browse files
author
Gusted
authored
Use provided database Engine (#17595)
- Don't get the engine from `db.DefaultContext`, instead use the provided one which is passed as paramater `e`.
1 parent 03de593 commit 3a693bd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ func GetUsersWhoCanCreateOrgRepo(orgID int64) ([]*User, error) {
412412

413413
func getUsersWhoCanCreateOrgRepo(e db.Engine, orgID int64) ([]*User, error) {
414414
users := make([]*User, 0, 10)
415-
return users, db.GetEngine(db.DefaultContext).
415+
return users, e.
416416
Join("INNER", "`team_user`", "`team_user`.uid=`user`.id").
417417
Join("INNER", "`team`", "`team`.id=`team_user`.team_id").
418418
Where(builder.Eq{"team.can_create_org_repo": true}.Or(builder.Eq{"team.authorize": AccessModeOwner})).

models/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func (u *User) isVisibleToUser(e db.Engine, viewer *User) bool {
468468
}
469469

470470
// Now we need to check if they in some organization together
471-
count, err := db.GetEngine(db.DefaultContext).Table("team_user").
471+
count, err := e.Table("team_user").
472472
Where(
473473
builder.And(
474474
builder.Eq{"uid": viewer.ID},

0 commit comments

Comments
 (0)