From e458984dcbdb7a09295d6b3854a26b4a26c301c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 13:37:52 +0100 Subject: [PATCH] fix(web): keep the navigation on legal pages Signed-in users see the console navigation on the legal notice and privacy policy; visitors get a header with sign-in and language choice. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/api/legal.go | 12 +- internal/api/legal_test.go | 7 + internal/web/legal.templ | 27 +++- internal/web/legal_templ.go | 287 +++++++++++++++++++++--------------- 4 files changed, 208 insertions(+), 125 deletions(-) diff --git a/internal/api/legal.go b/internal/api/legal.go index c3d64b3..ddd000e 100644 --- a/internal/api/legal.go +++ b/internal/api/legal.go @@ -12,6 +12,7 @@ import ( "github.com/google/uuid" "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi" + "git.zb-server.de/ZB-Server/uptimesebi/internal/auth" "git.zb-server.de/ZB-Server/uptimesebi/internal/store" "git.zb-server.de/ZB-Server/uptimesebi/internal/tenant" "git.zb-server.de/ZB-Server/uptimesebi/internal/web" @@ -174,7 +175,16 @@ func (s *Server) legalPage(c *gin.Context) { internalError(c, err) return } - web.Render(c, http.StatusOK, web.LegalPage(s.pageFor(c, web.LegalTitleID(kind)), html)) + var me *web.Me + if sess := auth.Current(c); sess != nil { + m, _, err := s.consoleMe(c, sess) + if err != nil { + internalError(c, err) + return + } + me = &m + } + web.Render(c, http.StatusOK, web.LegalPage(s.pageFor(c, web.LegalTitleID(kind)), me, html)) return } c.Status(http.StatusNotFound) diff --git a/internal/api/legal_test.go b/internal/api/legal_test.go index 96cef8b..dab606b 100644 --- a/internal/api/legal_test.go +++ b/internal/api/legal_test.go @@ -46,6 +46,13 @@ func TestLegalDocuments(t *testing.T) { if st != http.StatusOK || !strings.Contains(html, "

Impressum

") || strings.Contains(html, "