From 194c9a1223ed0df4e24a294e37d794dae6a5b31b Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 28 Aug 2019 12:07:46 -0400 Subject: [PATCH] few refinements to tags --- activity.go | 4 ++-- honk.go | 9 ++++++--- upgradedb.go | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/activity.go b/activity.go index fd09760..7ffc15a 100644 --- a/activity.go +++ b/activity.go @@ -678,6 +678,7 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk { xonk.Onts = append(xonk.Onts, name) } } + xonk.Onts = oneofakind(xonk.Onts) } if originate(xid) != origin { log.Printf("original sin: %s <> %s", xid, origin) @@ -853,8 +854,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { t["href"] = m.where tags = append(tags, t) } - ooo := ontologies(h.Noise) - for _, o := range ooo { + for _, o := range h.Onts { t := junk.New() t["type"] = "Hashtag" o = strings.ToLower(o) diff --git a/honk.go b/honk.go index 0ce7b75..5f3acf3 100644 --- a/honk.go +++ b/honk.go @@ -669,6 +669,9 @@ func thelistingoftheontologies(w http.ResponseWriter, r *http.Request) { } onts = append(onts, []string{o, o[1:]}) } + if u == nil { + w.Header().Set("Cache-Control", "max-age=300") + } templinfo := getInfo(r) templinfo["Onts"] = onts err = readviews.Execute(w, "onts.html", templinfo) @@ -1309,10 +1312,10 @@ func savehonk(w http.ResponseWriter, r *http.Request) { } return } - onts := ontologies(honk.Noise) + honk.Onts = oneofakind(ontologies(honk.Noise)) res, err := stmtSaveHonk.Exec(userinfo.UserID, what, honk.Honker, xid, rid, dt.Format(dbtimeformat), "", aud, honk.Noise, convoy, whofore, "html", - honk.Precis, honk.Oonker, 0, strings.Join(onts, " ")) + honk.Precis, honk.Oonker, 0, strings.Join(honk.Onts, " ")) if err != nil { log.Printf("error saving honk: %s", err) http.Error(w, "something bad happened while saving", http.StatusInternalServerError) @@ -1327,7 +1330,7 @@ func savehonk(w http.ResponseWriter, r *http.Request) { return } } - for _, o := range onts { + for _, o := range honk.Onts { _, err = stmtSaveOnts.Exec(strings.ToLower(o), honk.ID) if err != nil { log.Printf("error saving ont: %s", err) diff --git a/upgradedb.go b/upgradedb.go index ba953e3..6296b42 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -146,7 +146,7 @@ func upgradedb() { onts := ontologies(noise) mo := re_more.FindAllString(noise, -1) for _, o := range mo { - onts = append(onts, "#" + o[7:]) + onts = append(onts, "#"+o[7:]) } if len(onts) > 0 { ontmap[honkid] = oneofakind(onts)