add a long ago link...

This commit is contained in:
Ted Unangst 2020-07-19 18:51:02 -04:00
parent 0e1ec60422
commit 3f7dcaad9e
3 changed files with 24 additions and 1 deletions

View File

@ -232,6 +232,13 @@ func gethonksforme(userid int64, wanted int64) []*Honk {
rows, err := stmtHonksForMe.Query(wanted, userid, dt, userid)
return getsomehonks(rows, err)
}
func gethonksfromlongago(userid int64, wanted int64) []*Honk {
now := time.Now().UTC()
dt1 := now.Add(-367 * 24 * time.Hour).Format(dbtimeformat)
dt2 := now.Add(-364 * 24 * time.Hour).Format(dbtimeformat)
rows, err := stmtHonksFromLongAgo.Query(wanted, userid, dt1, dt2, userid)
return getsomehonks(rows, err)
}
func getsavedhonks(userid int64, wanted int64) []*Honk {
rows, err := stmtHonksISaved.Query(wanted, userid)
return getsomehonks(rows, err)
@ -849,6 +856,7 @@ func cleanupdb(arg string) {
var stmtHonkers, stmtDubbers, stmtNamedDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateHonker *sql.Stmt
var stmtAnyXonk, stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt
var stmtHonksByOntology, stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt
var stmtHonksFromLongAgo *sql.Stmt
var stmtHonksByHonker, stmtSaveHonk, stmtUserByName, stmtUserByNumber *sql.Stmt
var stmtEventHonks, stmtOneBonk, stmtFindZonk, stmtFindXonk, stmtSaveDonk *sql.Stmt
var stmtFindFile, stmtGetFileData, stmtSaveFileData, stmtSaveFile *sql.Stmt
@ -893,6 +901,7 @@ func prepareStatements(db *sql.DB) {
stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit)
stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (what <> 'tonk')"+myhonkers+butnotthose+limit)
stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit)
stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt < ? and dt > ? and whofore = 2"+butnotthose+limit)
stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc")
stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on (honkers.xid = honks.honker or honkers.xid = honks.oonker) where honks.honkid > ? and honks.userid = ? and honkers.name = ?"+butnotthose+limit)
stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.honkid > ? and honks.userid = ? and (honker = ? or oonker = ?)"+butnotthose+limit)

View File

@ -34,15 +34,16 @@
<li><a href="/chatter">chatter</a>
<li><a href="/o">tags</a>
<li><a href="/events">events</a>
<li><a href="/longago">long ago</a>
<li><a id="savedlink" href="/saved">saved</a>
<li><a href="/honkers">honkers</a>
<li><a href="/hfcs">filters</a>
<li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">my honks</a>
<li><a href="/account">account</a>
<li style="list-style-type:none; margin-left:-1em">
<details>
<summary>more stuff</summary>
<ul>
<li><a href="/{{ .UserSep }}/{{ .UserInfo.Username }}">my honks</a>
<li><a href="/about">about</a>
<li><a href="/front">front</a>
<li><a href="/funzone">funzone</a>

13
web.go
View File

@ -117,6 +117,11 @@ func homepage(w http.ResponseWriter, r *http.Request) {
templinfo["PageName"] = "atme"
honks = gethonksforme(userid, 0)
honks = osmosis(honks, userid, false)
case "/longago":
templinfo["ServerMessage"] = "long ago and far away!"
templinfo["PageName"] = "longago"
honks = gethonksforme(userid, 0)
honks = osmosis(honks, userid, false)
case "/events":
templinfo["ServerMessage"] = "some recent and upcoming events"
templinfo["PageName"] = "events"
@ -2236,6 +2241,10 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
honks = gethonksforme(userid, wanted)
honks = osmosis(honks, userid, false)
templinfo["ServerMessage"] = "at me!"
case "longago":
honks = gethonksfromlongago(userid, wanted)
honks = osmosis(honks, userid, false)
templinfo["ServerMessage"] = "from long ago"
case "home":
honks = gethonksforuser(userid, wanted)
honks = osmosis(honks, userid, true)
@ -2329,6 +2338,9 @@ func apihandler(w http.ResponseWriter, r *http.Request) {
case "atme":
honks = gethonksforme(userid, wanted)
honks = osmosis(honks, userid, false)
case "longago":
honks = gethonksfromlongago(userid, wanted)
honks = osmosis(honks, userid, false)
case "home":
honks = gethonksforuser(userid, wanted)
honks = osmosis(honks, userid, true)
@ -2502,6 +2514,7 @@ func serve() {
loggedin.HandleFunc("/funzone", showfunzone)
loggedin.HandleFunc("/chpass", dochpass)
loggedin.HandleFunc("/atme", homepage)
loggedin.HandleFunc("/longago", homepage)
loggedin.HandleFunc("/hfcs", hfcspage)
loggedin.HandleFunc("/xzone", xzone)
loggedin.HandleFunc("/newhonk", newhonkpage)