notes on ro dont have comments

master
Bel LaPointe 2020-09-28 09:39:42 -06:00
parent b975a7c103
commit f60d0618e6
2 changed files with 3 additions and 1 deletions

View File

@ -115,7 +115,7 @@ func (n *Notes) commentFormer(urlPath string, md []byte) html.RenderNodeFunc {
}
}
return func(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool) {
if heading, ok := node.(*ast.Heading); ok && !entering {
if heading, ok := node.(*ast.Heading); !n.ro && ok && !entering {
nextHeader()
fmt.Fprintf(w, `
<form method="POST" action=%q class="comment">

View File

@ -4,10 +4,12 @@ import "local/notes-server/config"
type Notes struct {
root string
ro bool
}
func New() *Notes {
return &Notes{
root: config.Root,
ro: config.ReadOnly,
}
}