a page with no replies
This commit is contained in:
parent
a85f05c86b
commit
f96479423f
|
@ -119,6 +119,11 @@ func gethonksforuser(userid int64) []*Honk {
|
||||||
rows, err := stmtHonksForUser.Query(userid, dt, userid, userid)
|
rows, err := stmtHonksForUser.Query(userid, dt, userid, userid)
|
||||||
return getsomehonks(rows, err)
|
return getsomehonks(rows, err)
|
||||||
}
|
}
|
||||||
|
func gethonksforuserfirstclass(userid int64) []*Honk {
|
||||||
|
dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat)
|
||||||
|
rows, err := stmtHonksForUserFirstClass.Query(userid, dt, userid, userid)
|
||||||
|
return getsomehonks(rows, err)
|
||||||
|
}
|
||||||
func gethonksforme(userid int64) []*Honk {
|
func gethonksforme(userid int64) []*Honk {
|
||||||
dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat)
|
dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat)
|
||||||
rows, err := stmtHonksForMe.Query(userid, dt, userid)
|
rows, err := stmtHonksForMe.Query(userid, dt, userid)
|
||||||
|
@ -343,7 +348,7 @@ var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover, stmtOneHonker
|
||||||
var stmtThumbBiters, stmtDeleteHonk, stmtDeleteDonks, stmtDeleteOnts, stmtSaveZonker *sql.Stmt
|
var stmtThumbBiters, stmtDeleteHonk, stmtDeleteDonks, stmtDeleteOnts, stmtSaveZonker *sql.Stmt
|
||||||
var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker *sql.Stmt
|
var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker *sql.Stmt
|
||||||
var stmtSelectOnts, stmtSaveOnt, stmtUpdateFlags, stmtClearFlags *sql.Stmt
|
var stmtSelectOnts, stmtSaveOnt, stmtUpdateFlags, stmtClearFlags *sql.Stmt
|
||||||
var stmtSaveOld, stmtUpdateHonk *sql.Stmt
|
var stmtHonksForUserFirstClass, stmtSaveOld, stmtUpdateHonk *sql.Stmt
|
||||||
|
|
||||||
func preparetodie(db *sql.DB, s string) *sql.Stmt {
|
func preparetodie(db *sql.DB, s string) *sql.Stmt {
|
||||||
stmt, err := db.Prepare(s)
|
stmt, err := db.Prepare(s)
|
||||||
|
@ -369,6 +374,7 @@ func prepareStatements(db *sql.DB) {
|
||||||
stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+limit)
|
stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+limit)
|
||||||
stmtUserHonks = preparetodie(db, selecthonks+"where (whofore = 2 or whofore = ?) and username = ? and dt > ?"+limit)
|
stmtUserHonks = preparetodie(db, selecthonks+"where (whofore = 2 or whofore = ?) and username = ? and dt > ?"+limit)
|
||||||
stmtHonksForUser = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and honker in (select xid from honkers where userid = ? and flavor = 'sub' and combos not like '% - %')"+butnotthose+limit)
|
stmtHonksForUser = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and honker in (select xid from honkers where userid = ? and flavor = 'sub' and combos not like '% - %')"+butnotthose+limit)
|
||||||
|
stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and (what <> 'tonk') and honker in (select xid from honkers where userid = ? and flavor = 'sub' and combos not like '% - %')"+butnotthose+limit)
|
||||||
stmtHonksForMe = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit)
|
stmtHonksForMe = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit)
|
||||||
stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on (honkers.xid = honks.honker or honkers.xid = honks.oonker) where honks.userid = ? and honkers.name = ?"+butnotthose+limit)
|
stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on (honkers.xid = honks.honker or honkers.xid = honks.oonker) where honks.userid = ? and honkers.name = ?"+butnotthose+limit)
|
||||||
stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.userid = ? and (honker = ? or oonker = ?)"+butnotthose+limit)
|
stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.userid = ? and (honker = ? or oonker = ?)"+butnotthose+limit)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<summary>menu</summary>
|
<summary>menu</summary>
|
||||||
<p>
|
<p>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a id="firstlink" href="/first">first</a>
|
||||||
<li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a>
|
<li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a>
|
||||||
<li><a href="/honkers">honkers</a>
|
<li><a href="/honkers">honkers</a>
|
||||||
<li style="list-style-type:none; margin-left:-1em">
|
<li style="list-style-type:none; margin-left:-1em">
|
||||||
|
|
|
@ -166,8 +166,10 @@ function relinklinks() {
|
||||||
(function() {
|
(function() {
|
||||||
var el = document.getElementById("homelink")
|
var el = document.getElementById("homelink")
|
||||||
el.onclick = pageswitcher("home", "")
|
el.onclick = pageswitcher("home", "")
|
||||||
var el = document.getElementById("atmelink")
|
el = document.getElementById("atmelink")
|
||||||
el.onclick = pageswitcher("atme", "")
|
el.onclick = pageswitcher("atme", "")
|
||||||
|
el = document.getElementById("firstlink")
|
||||||
|
el.onclick = pageswitcher("first", "")
|
||||||
relinklinks()
|
relinklinks()
|
||||||
window.onpopstate = statechanger
|
window.onpopstate = statechanger
|
||||||
history.replaceState(curpagestate, "some title", "")
|
history.replaceState(curpagestate, "some title", "")
|
||||||
|
|
7
web.go
7
web.go
|
@ -90,6 +90,10 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path == "/atme" {
|
if r.URL.Path == "/atme" {
|
||||||
templinfo["PageName"] = "atme"
|
templinfo["PageName"] = "atme"
|
||||||
honks = gethonksforme(userid)
|
honks = gethonksforme(userid)
|
||||||
|
} else if r.URL.Path == "/first" {
|
||||||
|
templinfo["PageName"] = "first"
|
||||||
|
honks = gethonksforuser(userid)
|
||||||
|
honks = osmosis(honks, userid)
|
||||||
} else {
|
} else {
|
||||||
templinfo["PageName"] = "home"
|
templinfo["PageName"] = "home"
|
||||||
honks = gethonksforuser(userid)
|
honks = gethonksforuser(userid)
|
||||||
|
@ -1419,6 +1423,9 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
|
||||||
case "home":
|
case "home":
|
||||||
honks = gethonksforuser(userid)
|
honks = gethonksforuser(userid)
|
||||||
honks = osmosis(honks, userid)
|
honks = osmosis(honks, userid)
|
||||||
|
case "first":
|
||||||
|
honks = gethonksforuserfirstclass(userid)
|
||||||
|
honks = osmosis(honks, userid)
|
||||||
case "combo":
|
case "combo":
|
||||||
c := r.FormValue("c")
|
c := r.FormValue("c")
|
||||||
honks = gethonksbycombo(userid, c)
|
honks = gethonksbycombo(userid, c)
|
||||||
|
|
Loading…
Reference in New Issue