mirror of
https://github.com/go-gitea/gitea.git
synced 2025-09-12 18:00:35 +00:00
Fix SSH signing key path will be displayed in the pull request UI (#35381)
Closes #35361 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
asymkey_model "code.gitea.io/gitea/models/asymkey"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
git_model "code.gitea.io/gitea/models/git"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
@@ -99,7 +100,7 @@ type CommitFormOptions struct {
|
||||
UserCanPush bool
|
||||
RequireSigned bool
|
||||
WillSign bool
|
||||
SigningKey *git.SigningKey
|
||||
SigningKeyFormDisplay string
|
||||
WontSignReason string
|
||||
CanCreatePullRequest bool
|
||||
CanCreateBasePullRequest bool
|
||||
@@ -139,7 +140,7 @@ func PrepareCommitFormOptions(ctx *Context, doer *user_model.User, targetRepo *r
|
||||
protectionRequireSigned = protectedBranch.RequireSignedCommits
|
||||
}
|
||||
|
||||
willSign, signKeyID, _, err := asymkey_service.SignCRUDAction(ctx, targetRepo.RepoPath(), doer, targetRepo.RepoPath(), refName.String())
|
||||
willSign, signKey, _, err := asymkey_service.SignCRUDAction(ctx, targetRepo.RepoPath(), doer, targetRepo.RepoPath(), refName.String())
|
||||
wontSignReason := ""
|
||||
if asymkey_service.IsErrWontSign(err) {
|
||||
wontSignReason = string(err.(*asymkey_service.ErrWontSign).Reason)
|
||||
@@ -156,14 +157,14 @@ func PrepareCommitFormOptions(ctx *Context, doer *user_model.User, targetRepo *r
|
||||
canCreatePullRequest := targetRepo.UnitEnabled(ctx, unit_model.TypePullRequests) || canCreateBasePullRequest
|
||||
|
||||
opts := &CommitFormOptions{
|
||||
TargetRepo: targetRepo,
|
||||
WillSubmitToFork: submitToForkedRepo,
|
||||
CanCommitToBranch: canCommitToBranch,
|
||||
UserCanPush: canPushWithProtection,
|
||||
RequireSigned: protectionRequireSigned,
|
||||
WillSign: willSign,
|
||||
SigningKey: signKeyID,
|
||||
WontSignReason: wontSignReason,
|
||||
TargetRepo: targetRepo,
|
||||
WillSubmitToFork: submitToForkedRepo,
|
||||
CanCommitToBranch: canCommitToBranch,
|
||||
UserCanPush: canPushWithProtection,
|
||||
RequireSigned: protectionRequireSigned,
|
||||
WillSign: willSign,
|
||||
SigningKeyFormDisplay: asymkey_model.GetDisplaySigningKey(signKey),
|
||||
WontSignReason: wontSignReason,
|
||||
|
||||
CanCreatePullRequest: canCreatePullRequest,
|
||||
CanCreateBasePullRequest: canCreateBasePullRequest,
|
||||
|
Reference in New Issue
Block a user