0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-12 15:33:39 +02:00

fine tune

This commit is contained in:
wxiaoguang 2026-04-07 16:11:40 +08:00
parent 115b5829f5
commit 8017f5dcbf
2 changed files with 7 additions and 6 deletions

View File

@ -18,13 +18,14 @@ import (
// GetOrgRepositories get repos belonging to the given organization
func GetOrgRepositories(ctx context.Context, orgID int64) (RepositoryList, error) {
var orgRepos []*Repository
return orgRepos, db.GetEngine(ctx).Where("owner_id = ?", orgID).Find(&orgRepos)
err := db.GetEngine(ctx).Where("owner_id = ?", orgID).Find(&orgRepos)
return orgRepos, err
}
// GetOrgRepositoryIDs get repo IDs belonging to the given organization
func GetOrgRepositoryIDs(ctx context.Context, orgID int64) ([]int64, error) {
var repoIDs []int64
return repoIDs, db.GetEngine(ctx).Table("repository").Where("owner_id = ?", orgID).Cols("id").Find(&repoIDs)
func GetOrgRepositoryIDs(ctx context.Context, orgID int64) (repoIDs []int64, _ error) {
err := db.GetEngine(ctx).Table("repository").Where("owner_id = ?", orgID).Cols("id").Find(&repoIDs)
return repoIDs, err
}
type SearchTeamRepoOptions struct {
@ -32,7 +33,7 @@ type SearchTeamRepoOptions struct {
TeamID int64
}
// GetRepositories returns paginated repositories in team of organization.
// GetTeamRepositories returns paginated repositories in team of organization.
func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (RepositoryList, error) {
sess := db.GetEngine(ctx)
if opts.TeamID > 0 {

View File

@ -566,7 +566,7 @@ func DeleteOrgRepos(ctx *context.APIContext) {
return
}
// Start deletion in background with detached context
// Start deletion (slow) in background with detached context, so it can continue even if the request is canceled
go deleteOrgReposBackground(graceful.GetManager().ShutdownContext(), ctx.Org.Organization, repoIDs, ctx.Doer)
ctx.Status(http.StatusAccepted)