Rechtstexte als App-Seiten statt statischer HTML-Seiten

Impressum, Datenschutz und Beitragsordnung liegen als HTML-Fragmente in
frontend/src/docs und werden unter /impressum, /datenschutz und
/beitragsordnung in der App mit der einheitlichen Navigation gezeigt. Die
alten Adressen /static/docs/*.html leiten per 301 dorthin um.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
irrlicht
2026-10-09 22:02:55 +02:00
co-authored by Claude Opus 5.5
parent 15b0bfc69c
commit f0dbb67054
12 changed files with 106 additions and 145 deletions
+30
View File
@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"log/slog"
"net/http"
"net/http/httptest"
"net/netip"
"testing"
@@ -58,3 +59,32 @@ func (srv *testServer) resetToken(t *testing.T, username string) string {
}
return token
}
// TestOldDocURLs: die früheren statischen Rechtstexte leiten auf die
// App-Seiten um, andere Pfade darunter gibt es nicht mehr.
func TestOldDocURLs(t *testing.T) {
t.Parallel()
srv := newTestServer(t)
c := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error {
return http.ErrUseLastResponse
}}
for _, tc := range []struct {
path, wantLoc string
wantStatus int
}{
{"/static/docs/impressum.html", "/impressum", http.StatusMovedPermanently},
{"/static/docs/datenschutz.html", "/datenschutz", http.StatusMovedPermanently},
{"/static/docs/beitragsordnung.html", "/beitragsordnung", http.StatusMovedPermanently},
{"/static/docs/geheim.html", "", http.StatusNotFound},
} {
resp, err := c.Get(srv.URL + tc.path)
if err != nil {
t.Fatalf("GET %s: %v", tc.path, err)
}
_ = resp.Body.Close()
if resp.StatusCode != tc.wantStatus || resp.Header.Get("Location") != tc.wantLoc {
t.Errorf("GET %s: %d %q, erwartet %d %q", tc.path,
resp.StatusCode, resp.Header.Get("Location"), tc.wantStatus, tc.wantLoc)
}
}
}