Hide Reader link on private instance when unauth'd

Ref T576
This commit is contained in:
Matt Baer 2019-06-16 20:29:31 -04:00
parent a2088c1646
commit bf989eb696
4 changed files with 8 additions and 6 deletions

1
app.go
View file

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

View file

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

View file

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

View file

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