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) { func savexonk(user *WhatAbout, x *Honk) {
if x.What == "eradicate" { if x.What == "eradicate" {
log.Printf("eradicating %s by %s", x.RID, x.Honker) 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 { if err != nil {
log.Printf("error eradicating: %s", err) 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 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. 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 The what column further refines the type of honk. If a reply, tonk.
deleted, zonk. If shared, bonk. In particular for the case of bonk, there 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 aren't enough columns to store original honker and bonker.
out okay though. This seems to work out okay though.
Attachments are physically saved as files, and logically joined to honks via Attachments are physically saved as files, and logically joined to honks via
the donks table. Emus are saved as donks as well. 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. will be a short string, not a complete URL.
Note that some logical seeming joins won't work. The honker column of honks 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 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 identity crosses our path? This seems unnecessary. The honkers table is more
like a mapping of active relationships, not a directory of all peoples. 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 stmtHonkers, stmtDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateCombos *sql.Stmt
var stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *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 stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt
var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt
var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *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 = ?") stmtFileData = preparetodie(db, "select media, content from files where xid = ?")
stmtFindXonk = preparetodie(db, "select honkid from honks where userid = ? and xid = ?") stmtFindXonk = preparetodie(db, "select honkid from honks where userid = ? and xid = ?")
stmtSaveDonk = preparetodie(db, "insert into donks (honkid, fileid) values (?, ?)") 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 = ?") stmtZonkIt = preparetodie(db, "delete from honks where userid = ? and xid = ?")
stmtFindFile = preparetodie(db, "select fileid from files where url = ?") stmtFindFile = preparetodie(db, "select fileid from files where url = ?")
stmtSaveFile = preparetodie(db, "insert into files (xid, name, url, media, content) values (?, ?, ?, ?, ?)") stmtSaveFile = preparetodie(db, "insert into files (xid, name, url, media, content) values (?, ?, ?, ?, ?)")

Loading…
Cancel
Save