summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-12-10 16:14:24 +0800
committerGitHub <noreply@github.com>2021-12-10 16:14:24 +0800
commit3ca5dc7e32b372d14ff80d96f14b8f6a805862f1 (patch)
tree50d193ed0dacf2888d57b193a9b0d36065aff205 /modules/context/repo.go
parent0a9fcf63a49799ad3b0f146c54879161bac61e10 (diff)
downloadgitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.tar.gz
gitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.zip
Move keys to models/asymkey (#17917)
* Move keys to models/keys * Rename models/keys -> models/asymkey * change the missed package name * Fix package alias * Fix test * Fix docs * Fix test * Fix test * merge
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 694c483bd4..1725cb724d 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -25,6 +25,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
+ asymkey_service "code.gitea.io/gitea/services/asymkey"
"github.com/editorconfig/editorconfig-core-go/v2"
"github.com/unknwon/com"
@@ -120,7 +121,7 @@ func (r *Repository) CanCommitToBranch(doer *user_model.User) (CanCommitToBranch
requireSigned = protectedBranch.RequireSignedCommits
}
- sign, keyID, _, err := models.SignCRUDAction(r.Repository, doer, r.Repository.RepoPath(), git.BranchPrefix+r.BranchName)
+ sign, keyID, _, err := asymkey_service.SignCRUDAction(r.Repository.RepoPath(), doer, r.Repository.RepoPath(), git.BranchPrefix+r.BranchName)
canCommit := r.CanEnableEditor() && userCanPush
if requireSigned {
@@ -128,8 +129,8 @@ func (r *Repository) CanCommitToBranch(doer *user_model.User) (CanCommitToBranch
}
wontSignReason := ""
if err != nil {
- if models.IsErrWontSign(err) {
- wontSignReason = string(err.(*models.ErrWontSign).Reason)
+ if asymkey_service.IsErrWontSign(err) {
+ wontSignReason = string(err.(*asymkey_service.ErrWontSign).Reason)
err = nil
} else {
wontSignReason = "error"