From f06ee37e243eb379e8b44936474ecc55a04ba955 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 9 Oct 2020 00:43:15 +0800 Subject: [PATCH] Hide sync ssh keys button on admin dashboard if ssh disabled or builtin-ssh enabled (#13072) Co-authored-by: zeripath --- routers/admin/admin.go | 1 + templates/admin/dashboard.tmpl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 5dbc321e9..d0f027f5f 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -131,6 +131,7 @@ func Dashboard(ctx *context.Context) { // FIXME: update periodically updateSystemStatus() ctx.Data["SysStatus"] = sysStatus + ctx.Data["SSH"] = setting.SSH ctx.HTML(200, tplDashboard) } diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 99c215493..d52f82fb6 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -35,11 +35,13 @@ {{.i18n.Tr "admin.dashboard.git_gc_repos"}} + {{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer)}} {{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}
{{.i18n.Tr "admin.dashboard.resync_all_sshkeys.desc"}} + {{end}} {{.i18n.Tr "admin.dashboard.resync_all_hooks"}}