Hide Reader link on private instance when unauth'd

Ref T576
pull/123/head
Matt Baer 6 years ago
parent a2088c1646
commit bf989eb696
  1. 1
      app.go
  2. 1
      page/page.go
  3. 2
      templates/base.tmpl
  4. 2
      templates/include/footer.tmpl

@ -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
}

@ -27,6 +27,7 @@ type StaticPage struct {
Username string
Values map[string]string
Flashes []string
CanViewReader bool
}
// SanitizeHost alters the StaticPage to contain a real hostname. This is

@ -18,7 +18,7 @@
<nav id="user-nav">
<nav class="tabs">
<a href="/about"{{if eq .Path "/about"}} class="selected"{{end}}>About</a>
{{if and (not .SingleUser) .LocalTimeline}}<a href="/read"{{if eq .Path "/read"}} class="selected"{{end}}>Reader</a>{{end}}
{{if and (and (not .SingleUser) .LocalTimeline) .CanViewReader}}<a href="/read"{{if eq .Path "/read"}} class="selected"{{end}}>Reader</a>{{end}}
{{if and (not .SingleUser) (not .Username)}}<a href="/login"{{if eq .Path "/login"}} class="selected"{{end}}>Log in</a>{{end}}
</nav>
</nav>

@ -16,7 +16,7 @@
<h3><a class="home" href="/">{{.SiteName}}</a></h3>
<ul>
<li><a href="/about">about</a></li>
{{if and (not .SingleUser) .LocalTimeline}}<a href="/read">reader</a>{{end}}
{{if and (and (not .SingleUser) .LocalTimeline) .CanViewReader}}<a href="/read">reader</a>{{end}}
<li><a href="/privacy">privacy</a></li>
</ul>
</div>

Loading…
Cancel
Save