mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 09:33:11 +00:00
Hide Reader link on private instance when unauth'd
Ref T576
This commit is contained in:
parent
a2088c1646
commit
bf989eb696
4 changed files with 8 additions and 6 deletions
1
app.go
1
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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…
Reference in a new issue