From f455125d4de8c788143a24edefb8c6b2cef0f524 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 18 Nov 2015 21:21:47 -0500 Subject: fix #878 --- routers/repo/setting.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'routers/repo') 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") } -- cgit v1.2.3