From d12b5f742145c1567e4374874d381d3ad64f03a0 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 27 Aug 2019 22:07:08 -0400 Subject: [PATCH] better listing of onts --- honk.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/honk.go b/honk.go index 31c3288..7ddc927 100644 --- a/honk.go +++ b/honk.go @@ -649,7 +649,12 @@ func showontology(w http.ResponseWriter, r *http.Request) { } func thelistingoftheontologies(w http.ResponseWriter, r *http.Request) { - rows, err := stmtSelectOnts.Query() + u := login.GetUserInfo(r) + var userid int64 = -1 + if u != nil { + userid = u.UserID + } + rows, err := stmtSelectOnts.Query(userid) if err != nil { log.Printf("selection error: %s", err) return @@ -1814,7 +1819,7 @@ func prepareStatements(db *sql.DB) { stmtRecentHonkers = preparetodie(db, "select distinct(honker) from honks where userid = ? and honker not in (select xid from honkers where userid = ? and flavor = 'sub') order by honkid desc limit 100") stmtUpdateFlags = preparetodie(db, "update honks set flags = flags | ? where honkid = ?") stmtClearFlags = preparetodie(db, "update honks set flags = flags & ~ ? where honkid = ?") - stmtSelectOnts = preparetodie(db, "select distinct(ontology) from onts join honks on onts.honkid = honks.honkid where honks.whofore = 2") + stmtSelectOnts = preparetodie(db, "select distinct(ontology) from onts join honks on onts.honkid = honks.honkid where (honks.userid = ? or honks.whofore = 2)") } func ElaborateUnitTests() {