1
1
mirror of https://github.com/go-gitea/gitea synced 2025-10-31 19:38:23 +00:00

Merge branch 'main' into allow-force-push-protected-branches

This commit is contained in:
Henry Goodman
2024-01-11 18:59:27 +11:00
committed by GitHub
480 changed files with 4706 additions and 3755 deletions

View File

@@ -17,7 +17,6 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
@@ -132,7 +131,7 @@ func (protectBranch *ProtectedBranch) CanUserPush(ctx context.Context, user *use
return writeAccess
}
if base.Int64sContains(protectBranch.WhitelistUserIDs, user.ID) {
if slices.Contains(protectBranch.WhitelistUserIDs, user.ID) {
return true
}
@@ -182,7 +181,7 @@ func IsUserMergeWhitelisted(ctx context.Context, protectBranch *ProtectedBranch,
return permissionInRepo.CanWrite(unit.TypeCode)
}
if base.Int64sContains(protectBranch.MergeWhitelistUserIDs, userID) {
if slices.Contains(protectBranch.MergeWhitelistUserIDs, userID) {
return true
}
@@ -214,7 +213,7 @@ func IsUserOfficialReviewer(ctx context.Context, protectBranch *ProtectedBranch,
return writeAccess, nil
}
if base.Int64sContains(protectBranch.ApprovalsWhitelistUserIDs, user.ID) {
if slices.Contains(protectBranch.ApprovalsWhitelistUserIDs, user.ID) {
return true, nil
}