diff --git a/fun.go b/fun.go index 3aaac12..4d86f40 100644 --- a/fun.go +++ b/fun.go @@ -31,7 +31,7 @@ import ( "humungus.tedunangst.com/r/webs/htfilter" ) -func reverbolate(honks []*Honk) { +func reverbolate(userid int64, honks []*Honk) { filt := htfilter.New() for _, h := range honks { h.What += "ed" @@ -61,17 +61,16 @@ func reverbolate(honks []*Honk) { } zap := make(map[*Donk]bool) h.Noise = unpucker(h.Noise) - precis := h.Precis - if strings.HasPrefix(h.Noise, "

"+precis) { - precis = "" - } - if precis != "" { - if strings.IndexByte(precis, ':') == -1 { - precis = "summary: " + precis + h.Open = "open" + if userid != -1 { + if badword := unsee(userid, h.Precis, h.Noise); badword != "" { + if h.Precis == "" { + h.Precis = badword + } + h.Open = "" } - precis = "

" + precis + "

" } - h.HTML, _ = filt.String(precis + h.Noise) + h.HTML, _ = filt.String(h.Noise) emuxifier := func(e string) string { for _, d := range h.Donks { if d.Name == e { @@ -95,6 +94,13 @@ func reverbolate(honks []*Honk) { } } +func unsee(userid int64, precis string, noise string) string { + if precis != "" { + return "more..." + } + return "" +} + func osmosis(honks []*Honk, userid int64) []*Honk { zords := getzords(userid) j := 0 diff --git a/honk.go b/honk.go index 50a74b8..707a8c8 100644 --- a/honk.go +++ b/honk.go @@ -72,6 +72,7 @@ type Honk struct { Whofore int64 HTML template.HTML Style string + Open string Donks []*Donk } @@ -138,19 +139,21 @@ func homepage(w http.ResponseWriter, r *http.Request) { templinfo := getInfo(r) u := login.GetUserInfo(r) var honks []*Honk + var userid int64 = -1 if r.URL.Path == "/front" || u == nil { honks = getpublichonks() } else { + userid = u.UserID if r.URL.Path == "/atme" { - honks = gethonksforme(u.UserID) + honks = gethonksforme(userid) } else { - honks = gethonksforuser(u.UserID) - honks = osmosis(honks, u.UserID) + honks = gethonksforuser(userid) + honks = osmosis(honks, userid) } templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) } - reverbolate(honks) + reverbolate(userid, honks) templinfo["Honks"] = honks templinfo["ShowRSS"] = true @@ -202,7 +205,7 @@ func showrss(w http.ResponseWriter, r *http.Request) { } else { honks = getpublichonks() } - reverbolate(honks) + reverbolate(-1, honks) home := fmt.Sprintf("https://%s/", serverName) base := home @@ -620,14 +623,16 @@ func showhonk(w http.ResponseWriter, r *http.Request) { func honkpage(w http.ResponseWriter, r *http.Request, u *login.UserInfo, user *WhatAbout, honks []*Honk, infomsg string) { - reverbolate(honks) templinfo := getInfo(r) + var userid int64 = -1 if u != nil { templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) + userid = u.UserID } if u == nil { w.Header().Set("Cache-Control", "max-age=60") } + reverbolate(userid, honks) if user != nil { filt := htfilter.New() templinfo["Name"] = user.Name @@ -1071,7 +1076,7 @@ func savehonk(w http.ResponseWriter, r *http.Request) { } if r.FormValue("preview") == "preview" { honks := []*Honk{&honk} - reverbolate(honks) + reverbolate(userinfo.UserID, honks) templinfo := getInfo(r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["Honks"] = honks diff --git a/views/honk.html b/views/honk.html index e5b2261..3428141 100644 --- a/views/honk.html +++ b/views/honk.html @@ -37,7 +37,10 @@ in reply to: {{ .RID }} convoy: {{ .Convoy }} {{ end }} -

+

+

+{{ .Precis }} +

{{ .Precis }}

{{ .HTML }} {{ range .Donks }} {{ if .Local }} @@ -58,11 +61,11 @@ in reply to: {{ .RID }} {{ end }} {{ end }} {{ end }} -

+ {{ end }} {{ if $bonkcsrf }}

-

+
Actions
diff --git a/views/style.css b/views/style.css index a81985e..ca409c2 100644 --- a/views/style.css +++ b/views/style.css @@ -168,15 +168,18 @@ input[type=file] { .limited .noise a { color: #a79; } +details.noise[open] summary { + display: none; +} .inlineform { display: inline; } .inlineform select { } -.honk details summary { +.honk details.actions summary { color: #aab; } -.limited details summary { +.limited details.actions summary { color: #a79; } h1, h2 {