From bf989eb696ef43cc4d1499bf8c0ddc7ac1cca816 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sun, 16 Jun 2019 20:29:31 -0400 Subject: [PATCH] Hide Reader link on private instance when unauth'd Ref T576 --- app.go | 1 + page/page.go | 9 +++++---- templates/base.tmpl | 2 +- templates/include/footer.tmpl | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app.go b/app.go index 8aeedce..6bda838 100644 --- a/app.go +++ b/app.go @@ -289,6 +289,7 @@ func pageForReq(app *App, r *http.Request) page.StaticPage { p.Username = u.Username } } + p.CanViewReader = !app.cfg.App.Private || u != nil return p } diff --git a/page/page.go b/page/page.go index 4560382..2af5322 100644 --- a/page/page.go +++ b/page/page.go @@ -23,10 +23,11 @@ type StaticPage struct { HeaderNav bool // Request values - Path string - Username string - Values map[string]string - Flashes []string + Path string + Username string + Values map[string]string + Flashes []string + CanViewReader bool } // SanitizeHost alters the StaticPage to contain a real hostname. This is diff --git a/templates/base.tmpl b/templates/base.tmpl index 01ead5b..775dac9 100644 --- a/templates/base.tmpl +++ b/templates/base.tmpl @@ -18,7 +18,7 @@ diff --git a/templates/include/footer.tmpl b/templates/include/footer.tmpl index 252699d..32a7e68 100644 --- a/templates/include/footer.tmpl +++ b/templates/include/footer.tmpl @@ -16,7 +16,7 @@

{{.SiteName}}