zonking of bonking

master
Ted Unangst 5 years ago
parent 5ef64966f3
commit bf18145db8

@ -268,7 +268,13 @@ func needxonkid(user *WhatAbout, xid string) bool {
func savexonk(user *WhatAbout, x *Honk) {
if x.What == "eradicate" {
log.Printf("eradicating %s by %s", x.RID, x.Honker)
_, err := stmtDeleteHonk.Exec(x.RID, x.Honker, user.ID)
mh := re_unurl.FindStringSubmatch(x.Honker)
mr := re_unurl.FindStringSubmatch(x.RID)
if len(mh) < 2 || len(mr) < 2 || mh[1] != mr[1] {
log.Printf("not deleting owner mismatch")
return
}
_, err := stmtZonkIt.Exec(user.ID, x.RID)
if err != nil {
log.Printf("error eradicating: %s", err)
}

@ -51,10 +51,10 @@ view. (Previously this was accomplished via separate tables. That made some
queries more difficult, but I think it's possible to workaround this. It would
be considerably safer.) The honker column will be empty for local honks.
The what column further refines the type of honk. If a reply, tonk. If
deleted, zonk. If shared, bonk. In particular for the case of bonk, there
aren't enough columns to store original honker and bonker. This seems to work
out okay though.
The what column further refines the type of honk. If a reply, tonk.
If shared, bonk. In particular for the case of bonk, there
aren't enough columns to store original honker and bonker.
This seems to work out okay though.
Attachments are physically saved as files, and logically joined to honks via
the donks table. Emus are saved as donks as well.
@ -73,7 +73,7 @@ The xid column generally corresponds to ActivityPub id. For local honks, it
will be a short string, not a complete URL.
Note that some logical seeming joins won't work. The honker column of honks
does not have a corresponding entry in the honkers table, since we frequently
may not have a corresponding entry in the honkers table, since we frequently
receive messages from people we don't follow. Should we track everybody whose
identity crosses our path? This seems unnecessary. The honkers table is more
like a mapping of active relationships, not a directory of all peoples.

@ -1303,7 +1303,7 @@ func serve() {
var stmtHonkers, stmtDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateCombos *sql.Stmt
var stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt
var stmtHonksForUser, stmtHonksForMe, stmtDeleteHonk, stmtSaveDub *sql.Stmt
var stmtHonksForUser, stmtHonksForMe, stmtSaveDub *sql.Stmt
var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt
var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt
var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt
@ -1342,7 +1342,6 @@ func prepareStatements(db *sql.DB) {
stmtFileData = preparetodie(db, "select media, content from files where xid = ?")
stmtFindXonk = preparetodie(db, "select honkid from honks where userid = ? and xid = ?")
stmtSaveDonk = preparetodie(db, "insert into donks (honkid, fileid) values (?, ?)")
stmtDeleteHonk = preparetodie(db, "delete from honks where xid = ? and honker = ? and userid = ?")
stmtZonkIt = preparetodie(db, "delete from honks where userid = ? and xid = ?")
stmtFindFile = preparetodie(db, "select fileid from files where url = ?")
stmtSaveFile = preparetodie(db, "insert into files (xid, name, url, media, content) values (?, ?, ?, ?, ?)")

Loading…
Cancel
Save