reply topic
parent
53ab6042ee
commit
2eb9377cc0
|
@ -28,8 +28,12 @@
|
|||
{{ end }}
|
||||
|
||||
{{ with .Echo }}
|
||||
{{ if $.Topic }}
|
||||
:: <a href="/{{$.Topic}}/reply">Reply topic</a>
|
||||
{{ else }}
|
||||
:: <a href="/{{.}}/new">New topic</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ else if eq .BasePath "login" }}
|
||||
<a href="/register">Register</a>
|
||||
|
|
|
@ -17,6 +17,7 @@ const PAGE_SIZE = 100
|
|||
type WebContext struct {
|
||||
Echoes []*ii.Echo
|
||||
Topics []*Topic
|
||||
Topic string
|
||||
Msg []*ii.Msg
|
||||
Error string
|
||||
Echo string
|
||||
|
@ -269,6 +270,7 @@ func www_topic(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request, i
|
|||
}
|
||||
topic = p.Id
|
||||
}
|
||||
ctx.Topic = topic
|
||||
ids := getTopics(db, mis)[topic]
|
||||
if len(ids) == 0 {
|
||||
ids = append(ids, id)
|
||||
|
@ -464,6 +466,10 @@ func msg_quote(txt string) string {
|
|||
txt = msg_clean(txt)
|
||||
f := ""
|
||||
for _, l := range strings.Split(txt, "\n") {
|
||||
if strings.Trim(l, " ") == "" {
|
||||
f += l + "\n"
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(l, ">") {
|
||||
f += ">"+ l + "\n"
|
||||
} else {
|
||||
|
|
5
ii/db.go
5
ii/db.go
|
@ -608,7 +608,10 @@ type UDB struct {
|
|||
}
|
||||
|
||||
func IsUsername(u string) bool {
|
||||
return !strings.ContainsAny(u, ":\n \r\t") && len(u) <= 16 && len(u) > 2
|
||||
return !strings.ContainsAny(u, ":\n\r\t") &&
|
||||
!strings.HasPrefix(u, " ") &&
|
||||
!strings.HasSuffix(u, " ") &&
|
||||
len(u) <= 16 && len(u) > 2
|
||||
}
|
||||
|
||||
func IsPassword(u string) bool {
|
||||
|
|
Loading…
Reference in New Issue