mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 18:56:11 +01:00
e81ccc406b
Change all license headers to comply with REUSE specification. Fix #16132 Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
24 lines
671 B
Go
24 lines
671 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package repository
|
|
|
|
import (
|
|
"code.gitea.io/gitea/models/db"
|
|
"code.gitea.io/gitea/models/organization"
|
|
"code.gitea.io/gitea/models/perm"
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
|
)
|
|
|
|
// GetReviewerTeams get all teams can be requested to review
|
|
func GetReviewerTeams(repo *repo_model.Repository) ([]*organization.Team, error) {
|
|
if err := repo.GetOwner(db.DefaultContext); err != nil {
|
|
return nil, err
|
|
}
|
|
if !repo.Owner.IsOrganization() {
|
|
return nil, nil
|
|
}
|
|
|
|
return organization.GetTeamsWithAccessToRepo(db.DefaultContext, repo.OwnerID, repo.ID, perm.AccessModeRead)
|
|
}
|