aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-18 21:21:47 -0500
committerUnknwon <u@gogs.io>2015-11-18 21:21:47 -0500
commitf455125d4de8c788143a24edefb8c6b2cef0f524 (patch)
treeb6a258d73a3e25362fd0005b2954ebe84869fede /routers/repo
parentdf339ad8b0c4f8858a53a4890ded97a1e3208b13 (diff)
downloadgitea-f455125d4de8c788143a24edefb8c6b2cef0f524.tar.gz
gitea-f455125d4de8c788143a24edefb8c6b2cef0f524.zip
fix #878
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/setting.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 019949b793..2d686cdd34 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -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")
}