diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-06-12 23:51:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 23:51:54 +0800 |
commit | 110fc57cbcf293c19ed7017d8ea528b4bbbd7396 (patch) | |
tree | b36eb2ee0e3f8417a35ad095e25880b778ded0ba /services/asymkey | |
parent | a9dc9b06e4a4106ec8315fe7b2922efa440ca199 (diff) | |
download | gitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.tar.gz gitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.zip |
Move some code into models/git (#19879)
* Move access and repo permission to models/perm/access
* fix test
* Move some git related files into sub package models/git
* Fix build
* fix git test
* move lfs to sub package
* move more git related functions to models/git
* Move functions sequence
* Some improvements per @KN4CK3R and @delvh
Diffstat (limited to 'services/asymkey')
-rw-r--r-- | services/asymkey/sign.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/asymkey/sign.go b/services/asymkey/sign.go index 2431146f97..0f74cd4b2a 100644 --- a/services/asymkey/sign.go +++ b/services/asymkey/sign.go @@ -13,6 +13,7 @@ import ( asymkey_model "code.gitea.io/gitea/models/asymkey" "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/db" + git_model "code.gitea.io/gitea/models/git" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" @@ -310,14 +311,14 @@ Loop: return false, "", nil, &ErrWontSign{twofa} } case approved: - protectedBranch, err := models.GetProtectedBranchBy(ctx, repo.ID, pr.BaseBranch) + protectedBranch, err := git_model.GetProtectedBranchBy(ctx, repo.ID, pr.BaseBranch) if err != nil { return false, "", nil, err } if protectedBranch == nil { return false, "", nil, &ErrWontSign{approved} } - if protectedBranch.GetGrantedApprovalsCount(ctx, pr) < 1 { + if models.GetGrantedApprovalsCount(ctx, protectedBranch, pr) < 1 { return false, "", nil, &ErrWontSign{approved} } case baseSigned: |