diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2019-11-16 20:39:18 +0100 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-11-16 19:39:18 +0000 |
commit | 86cff86b46116353e4d6605ccf5a77a7ac65bc78 (patch) | |
tree | c4b0cefc24d333f64682d9b31a91ad42406a6aef /models/branches.go | |
parent | 3dfe9190b05b68497478324a776c1f80d6f5e56d (diff) | |
download | gitea-86cff86b46116353e4d6605ccf5a77a7ac65bc78.tar.gz gitea-86cff86b46116353e4d6605ccf5a77a7ac65bc78.zip |
Update branch API endpoint to show effective branch protection. (#9031)
* Add API endpoint for displaying effective branch protection.
* Add status checks.
Diffstat (limited to 'models/branches.go')
-rw-r--r-- | models/branches.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go index c5f227f1e5..46670b18a0 100644 --- a/models/branches.go +++ b/models/branches.go @@ -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 { |