mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Update branch API endpoint to show effective branch protection. (#9031)
* Add API endpoint for displaying effective branch protection. * Add status checks.
This commit is contained in:
committed by
zeripath
parent
3dfe9190b0
commit
86cff86b46
@@ -242,6 +242,11 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
|
||||
return protectedBranches, x.Find(&protectedBranches, &ProtectedBranch{RepoID: repo.ID})
|
||||
}
|
||||
|
||||
// GetBranchProtection get the branch protection of a branch
|
||||
func (repo *Repository) GetBranchProtection(branchName string) (*ProtectedBranch, error) {
|
||||
return GetProtectedBranchBy(repo.ID, branchName)
|
||||
}
|
||||
|
||||
// IsProtectedBranch checks if branch is protected
|
||||
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
|
||||
if doer == nil {
|
||||
|
Reference in New Issue
Block a user