mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
fix #878
This commit is contained in:
parent
df339ad8b0
commit
f455125d4d
11 changed files with 220 additions and 39 deletions
|
@ -259,9 +259,9 @@ func Webhooks(ctx *middleware.Context) {
|
|||
ctx.Data["BaseLink"] = ctx.Repo.RepoLink
|
||||
ctx.Data["Description"] = ctx.Tr("repo.settings.hooks_desc", "https://github.com/gogits/go-gogs-client/wiki/Repositories---Webhooks")
|
||||
|
||||
ws, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.ID)
|
||||
ws, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetWebhooksByRepoId", err)
|
||||
ctx.Handle(500, "GetWebhooksByRepoID", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Webhooks"] = ws
|
||||
|
@ -684,7 +684,7 @@ func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||
|
||||
content, err := models.CheckPublicKeyString(form.Content)
|
||||
if err != nil {
|
||||
if err == models.ErrKeyUnableVerify {
|
||||
if models.IsErrKeyUnableVerify(err) {
|
||||
ctx.Flash.Info(ctx.Tr("form.unable_verify_ssh_key"))
|
||||
} else {
|
||||
ctx.Data["HasError"] = true
|
||||
|
@ -695,7 +695,8 @@ func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||
}
|
||||
}
|
||||
|
||||
if err = models.AddDeployKey(ctx.Repo.Repository.ID, form.Title, content); err != nil {
|
||||
key, err := models.AddDeployKey(ctx.Repo.Repository.ID, form.Title, content)
|
||||
if err != nil {
|
||||
ctx.Data["HasError"] = true
|
||||
switch {
|
||||
case models.IsErrKeyAlreadyExist(err):
|
||||
|
@ -711,7 +712,7 @@ func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||
}
|
||||
|
||||
log.Trace("Deploy key added: %d", ctx.Repo.Repository.ID)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_key_success", form.Title))
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_key_success", key.Name))
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue