Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactoring of modules/private #15947

Merged
merged 9 commits into from
Jun 23, 2021
Prev Previous commit
Next Next commit
Removed unused method.
KN4CK3R committed May 22, 2021
commit b82ac6072dfa2f426f88b69ca79f5f09ad757954
21 changes: 0 additions & 21 deletions models/branches.go
Original file line number Diff line number Diff line change
@@ -375,27 +375,6 @@ func (repo *Repository) IsProtectedBranch(branchName string) (bool, error) {
return has, nil
}

// IsProtectedBranchForPush checks if branch is protected for push
func (repo *Repository) IsProtectedBranchForPush(branchName string, doer *User) (bool, error) {
if doer == nil {
return true, nil
}

protectedBranch := &ProtectedBranch{
RepoID: repo.ID,
BranchName: branchName,
}

has, err := x.Get(protectedBranch)
if err != nil {
return true, err
} else if has {
return !protectedBranch.CanUserPush(doer.ID), nil
}

return false, nil
}

// updateApprovalWhitelist checks whether the user whitelist changed and returns a whitelist with
// the users from newWhitelist which have explicit read or write access to the repo.
func updateApprovalWhitelist(repo *Repository, currentWhitelist, newWhitelist []int64) (whitelist []int64, err error) {