aboutsummaryrefslogtreecommitdiffstats
path: root/models/organization/team.go
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-03 12:30:41 +0200
committerGitHub <noreply@github.com>2023-10-03 10:30:41 +0000
commitcc5df266808361c1dd3a1d17cbba712826a93d7e (patch)
treef77c59a61d3dc36f07b5b84596e4a1cde12b55cc /models/organization/team.go
parent08507e2760638124d75774c29ef37e692a88c02d (diff)
downloadgitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.tar.gz
gitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.zip
Even more `db.DefaultContext` refactor (#27352)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'models/organization/team.go')
-rw-r--r--models/organization/team.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/models/organization/team.go b/models/organization/team.go
index 3624fdc466..72afc67369 100644
--- a/models/organization/team.go
+++ b/models/organization/team.go
@@ -144,8 +144,8 @@ func (t *Team) IsOwnerTeam() bool {
}
// IsMember returns true if given user is a member of team.
-func (t *Team) IsMember(userID int64) bool {
- isMember, err := IsTeamMember(db.DefaultContext, t.OrgID, t.ID, userID)
+func (t *Team) IsMember(ctx context.Context, userID int64) bool {
+ isMember, err := IsTeamMember(ctx, t.OrgID, t.ID, userID)
if err != nil {
log.Error("IsMember: %v", err)
return false
@@ -217,10 +217,10 @@ func GetTeam(ctx context.Context, orgID int64, name string) (*Team, error) {
}
// GetTeamIDsByNames returns a slice of team ids corresponds to names.
-func GetTeamIDsByNames(orgID int64, names []string, ignoreNonExistent bool) ([]int64, error) {
+func GetTeamIDsByNames(ctx context.Context, orgID int64, names []string, ignoreNonExistent bool) ([]int64, error) {
ids := make([]int64, 0, len(names))
for _, name := range names {
- u, err := GetTeam(db.DefaultContext, orgID, name)
+ u, err := GetTeam(ctx, orgID, name)
if err != nil {
if ignoreNonExistent {
continue
@@ -251,13 +251,13 @@ func GetTeamByID(ctx context.Context, teamID int64) (*Team, error) {
}
// GetTeamNamesByID returns team's lower name from a list of team ids.
-func GetTeamNamesByID(teamIDs []int64) ([]string, error) {
+func GetTeamNamesByID(ctx context.Context, teamIDs []int64) ([]string, error) {
if len(teamIDs) == 0 {
return []string{}, nil
}
var teamNames []string
- err := db.GetEngine(db.DefaultContext).Table("team").
+ err := db.GetEngine(ctx).Table("team").
Select("lower_name").
In("id", teamIDs).
Asc("name").