summaryrefslogtreecommitdiffstats
path: root/models/org_team.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-20 22:08:52 +0800
committerGitHub <noreply@github.com>2022-05-20 22:08:52 +0800
commitfd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch)
tree50038348ec10485f72344f3ac80324e04abc1283 /models/org_team.go
parentd81e31ad7826a81fc7139f329f250594610a274b (diff)
downloadgitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz
gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
Diffstat (limited to 'models/org_team.go')
-rw-r--r--models/org_team.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/models/org_team.go b/models/org_team.go
index 0aba0cbb23..f1d35ee189 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -44,7 +44,7 @@ func addRepository(ctx context.Context, t *organization.Team, repo *repo_model.R
return fmt.Errorf("getMembers: %v", err)
}
for _, u := range t.Members {
- if err = repo_model.WatchRepoCtx(ctx, u.ID, repo.ID, true); err != nil {
+ if err = repo_model.WatchRepo(ctx, u.ID, repo.ID, true); err != nil {
return fmt.Errorf("watchRepo: %v", err)
}
}
@@ -147,12 +147,12 @@ func removeAllRepositories(ctx context.Context, t *organization.Team) (err error
continue
}
- if err = repo_model.WatchRepoCtx(ctx, user.ID, repo.ID, false); err != nil {
+ if err = repo_model.WatchRepo(ctx, user.ID, repo.ID, false); err != nil {
return err
}
// Remove all IssueWatches a user has subscribed to in the repositories
- if err = removeIssueWatchersByRepoID(e, user.ID, repo.ID); err != nil {
+ if err = removeIssueWatchersByRepoID(ctx, user.ID, repo.ID); err != nil {
return err
}
}
@@ -210,12 +210,12 @@ func removeRepository(ctx context.Context, t *organization.Team, repo *repo_mode
continue
}
- if err = repo_model.WatchRepoCtx(ctx, teamUser.UID, repo.ID, false); err != nil {
+ if err = repo_model.WatchRepo(ctx, teamUser.UID, repo.ID, false); err != nil {
return err
}
// Remove all IssueWatches a user has subscribed to in the repositories
- if err := removeIssueWatchersByRepoID(e, teamUser.UID, repo.ID); err != nil {
+ if err := removeIssueWatchersByRepoID(ctx, teamUser.UID, repo.ID); err != nil {
return err
}
}
@@ -555,7 +555,7 @@ func AddTeamMember(team *organization.Team, userID int64) error {
}
go func(repos []*repo_model.Repository) {
for _, repo := range repos {
- if err = repo_model.WatchRepoCtx(db.DefaultContext, userID, repo.ID, true); err != nil {
+ if err = repo_model.WatchRepo(db.DefaultContext, userID, repo.ID, true); err != nil {
log.Error("watch repo failed: %v", err)
}
}