summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-07-26 17:22:39 +0800
committerGitHub <noreply@github.com>2023-07-26 09:22:39 +0000
commitc598741f01f9ccf32d0c4bdd905f4dc58f7af806 (patch)
tree9ba5ec390112aa5dd8f2194cc761e5b06e2d7f3d /routers
parentbc73e6a85c04d4f63b77dea9f1deac5b21d3678c (diff)
downloadgitea-c598741f01f9ccf32d0c4bdd905f4dc58f7af806.tar.gz
gitea-c598741f01f9ccf32d0c4bdd905f4dc58f7af806.zip
Display deprecated warning in admin panel pages as well as in the log file (#26094) (#26154)
backport #26094 Temporily resolve #25915 Related #25994 This PR includes #26007 's changes but have a UI to prompt administrator about the deprecated settings as well as the log or console warning. Then users will have enough time to notice the problem and don't have surprise like before. <img width="1293" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/c33355f0-1ea7-4fb3-ad43-cd23cd15391d">
Diffstat (limited to 'routers')
-rw-r--r--routers/web/admin/admin.go11
-rw-r--r--routers/web/admin/config.go2
2 files changed, 13 insertions, 0 deletions
diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go
index 797ba8798d..3e050e6949 100644
--- a/routers/web/admin/admin.go
+++ b/routers/web/admin/admin.go
@@ -110,6 +110,16 @@ func updateSystemStatus() {
sysStatus.NumGC = m.NumGC
}
+func prepareDeprecatedWarningsAlert(ctx *context.Context) {
+ if len(setting.DeprecatedWarnings) > 0 {
+ content := setting.DeprecatedWarnings[0]
+ if len(setting.DeprecatedWarnings) > 1 {
+ content += fmt.Sprintf(" (and %d more)", len(setting.DeprecatedWarnings)-1)
+ }
+ ctx.Flash.Error(content, true)
+ }
+}
+
// Dashboard show admin panel dashboard
func Dashboard(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
@@ -120,6 +130,7 @@ func Dashboard(ctx *context.Context) {
updateSystemStatus()
ctx.Data["SysStatus"] = sysStatus
ctx.Data["SSH"] = setting.SSH
+ prepareDeprecatedWarningsAlert(ctx)
ctx.HTML(http.StatusOK, tplDashboard)
}
diff --git a/routers/web/admin/config.go b/routers/web/admin/config.go
index b7d9976815..ba0d862645 100644
--- a/routers/web/admin/config.go
+++ b/routers/web/admin/config.go
@@ -171,6 +171,8 @@ func Config(ctx *context.Context) {
ctx.Data["Loggers"] = log.GetManager().DumpLoggers()
+ prepareDeprecatedWarningsAlert(ctx)
+
ctx.HTML(http.StatusOK, tplConfig)
}