all repos — honk @ a504f3774072be850266c2ecfe95e583daba38ff

my fork of honk

see what happens if we start saving badonks
Ted Unangst tedu@tedunangst.com
Tue, 09 Feb 2021 08:18:22 -0500
commit

a504f3774072be850266c2ecfe95e583daba38ff

parent

0e328d91fe0025684c744a78adeba9e5ccd685f4

3 files changed, 28 insertions(+), 1 deletions(-)

jump to
M database.godatabase.go

@@ -798,6 +798,20 @@ }

return nil } +func addreaction(user *WhatAbout, xid string, who, react string) { + h := getxonk(user.ID, xid) + if h == nil { + return + } + h.Badonks = append(h.Badonks, Badonk{Who: who, What: react}) + j, _ := jsonify(h.Badonks) + db := opendatabase() + tx, _ := db.Begin() + _, _ = tx.Stmt(stmtDeleteOneMeta).Exec(h.ID, "badonks") + _, _ = tx.Stmt(stmtSaveMeta).Exec(h.ID, "badonks", j) + tx.Commit() +} + func deleteextras(tx *sql.Tx, honkid int64, everything bool) error { _, err := tx.Stmt(stmtDeleteDonks).Exec(honkid) if err != nil {

@@ -914,7 +928,7 @@ var stmtUntagged, stmtDeleteHonk, stmtDeleteDonks, stmtDeleteOnts, stmtSaveZonker *sql.Stmt

var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker *sql.Stmt var stmtAllOnts, stmtSaveOnt, stmtUpdateFlags, stmtClearFlags *sql.Stmt var stmtHonksForUserFirstClass *sql.Stmt -var stmtSaveMeta, stmtDeleteAllMeta, stmtDeleteSomeMeta, stmtUpdateHonk *sql.Stmt +var stmtSaveMeta, stmtDeleteAllMeta, stmtDeleteOneMeta, stmtDeleteSomeMeta, stmtUpdateHonk *sql.Stmt var stmtHonksISaved, stmtGetFilters, stmtSaveFilter, stmtDeleteFilter *sql.Stmt var stmtGetTracks *sql.Stmt var stmtSaveChonk, stmtLoadChonks, stmtGetChatters *sql.Stmt

@@ -962,6 +976,7 @@

stmtSaveMeta = preparetodie(db, "insert into honkmeta (honkid, genus, json) values (?, ?, ?)") stmtDeleteAllMeta = preparetodie(db, "delete from honkmeta where honkid = ?") stmtDeleteSomeMeta = preparetodie(db, "delete from honkmeta where honkid = ? and genus not in ('oldrev')") + stmtDeleteOneMeta = preparetodie(db, "delete from honkmeta where honkid = ? and genus = ?") stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") stmtDeleteHonk = preparetodie(db, "delete from honks where honkid = ?") stmtUpdateHonk = preparetodie(db, "update honks set precis = ?, noise = ?, format = ?, whofore = ?, dt = ? where honkid = ?")
M honk.gohonk.go

@@ -96,6 +96,12 @@ Onts []string

Place *Place Time *Time Mentions []Mention + Badonks []Badonk +} + +type Badonk struct { + Who string + What string } type Chonk struct {
M web.goweb.go

@@ -429,6 +429,12 @@ case "Like":

default: log.Printf("unknown undo: %s", what) } + case "EmojiReact": + obj, ok := j.GetString("object") + if ok { + content, _ := j.GetString("content") + addreaction(user, obj, who, content) + } default: go xonksaver(user, j, origin) }