code.gitea.io/gitea@v1.21.7/services/repository/review.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package repository 5 6 import ( 7 "context" 8 9 "code.gitea.io/gitea/models/organization" 10 "code.gitea.io/gitea/models/perm" 11 repo_model "code.gitea.io/gitea/models/repo" 12 ) 13 14 // GetReviewerTeams get all teams can be requested to review 15 func GetReviewerTeams(ctx context.Context, repo *repo_model.Repository) ([]*organization.Team, error) { 16 if err := repo.LoadOwner(ctx); err != nil { 17 return nil, err 18 } 19 if !repo.Owner.IsOrganization() { 20 return nil, nil 21 } 22 23 return organization.GetTeamsWithAccessToRepo(ctx, repo.OwnerID, repo.ID, perm.AccessModeRead) 24 }