people really want to believe that deletion can work.

i think it's dangerous to perpetuate this belief,
but i'm not interested in being the internet archive either.
This commit is contained in:
Ted Unangst 2019-05-03 13:42:39 -04:00
parent fb75d9f4b1
commit 90a6e0f7c3
7 changed files with 26 additions and 29 deletions

View File

@ -680,22 +680,14 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
} }
switch h.What { switch h.What {
case "zonk":
fallthrough
case "tonk": case "tonk":
fallthrough fallthrough
case "honk": case "honk":
j["type"] = "Create" j["type"] = "Create"
if h.What == "zonk" {
j["type"] = "Delete"
}
jo = NewJunk() jo = NewJunk()
jo["id"] = user.URL + "/h/" + h.XID jo["id"] = user.URL + "/h/" + h.XID
jo["type"] = "Note" jo["type"] = "Note"
if h.What == "zonk" {
jo["type"] = "Tombstone"
}
jo["published"] = dt jo["published"] = dt
jo["url"] = user.URL + "/h/" + h.XID jo["url"] = user.URL + "/h/" + h.XID
jo["attributedTo"] = user.URL jo["attributedTo"] = user.URL
@ -756,6 +748,9 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
case "bonk": case "bonk":
j["type"] = "Announce" j["type"] = "Announce"
j["object"] = h.XID j["object"] = h.XID
case "zonk":
j["type"] = "Delete"
j["object"] = user.URL + "/h/" + h.XID
} }
return j, jo return j, jo

View File

@ -26,9 +26,8 @@ Cant be useful for managing as part of a combo, however.
-- zonking -- zonking
You can zonk anything you like (or dislike), either your own honk or You can zonk anything you like (or dislike), either your own honk or
those of others that you're tired of seeing. This reduces its visibility, but those of others that you're tired of seeing. Be advised that deletion
doesn't attempt to delete it, which is infeasible. works poorly in a federated environment. It's more like please disregard.
It's more like disavow or disregard.
The killzone supports blocking unwanted contacts. One may block an actor The killzone supports blocking unwanted contacts. One may block an actor
(zonker), a domain (zurl), or thread (zonvoy). (zonker), a domain (zurl), or thread (zonvoy).

20
honk.go
View File

@ -711,9 +711,6 @@ func donksforhonks(honks []*Honk) {
var ids []string var ids []string
hmap := make(map[int64]*Honk) hmap := make(map[int64]*Honk)
for _, h := range honks { for _, h := range honks {
if h.What == "zonk" {
continue
}
ids = append(ids, fmt.Sprintf("%d", h.ID)) ids = append(ids, fmt.Sprintf("%d", h.ID))
hmap[h.ID] = h hmap[h.ID] = h
} }
@ -814,7 +811,20 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
log.Printf("zonking %s %s", wherefore, what) log.Printf("zonking %s %s", wherefore, what)
userinfo := login.GetUserInfo(r) userinfo := login.GetUserInfo(r)
if wherefore == "zonk" { if wherefore == "zonk" {
xonk := getxonk(userinfo.Username, what)
stmtZonkIt.Exec(userinfo.UserID, what) stmtZonkIt.Exec(userinfo.UserID, what)
if xonk != nil && xonk.Honker == "" {
zonk := Honk{
What: "zonk",
XID: xonk.XID,
Date: time.Now().UTC(),
Audience: oneofakind(xonk.Audience),
}
user, _ := butwhatabout(userinfo.Username)
log.Printf("announcing deleted honk: %s", what)
go honkworldwide(user, &zonk)
}
} else { } else {
_, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore) _, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore)
if err != nil { if err != nil {
@ -1331,7 +1341,8 @@ 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, "update honks set what = 'zonk' where xid = ? and honker = ? and userid = ?") 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 = ?") 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 (?, ?, ?, ?, ?)")
stmtWhatAbout = preparetodie(db, "select userid, username, displayname, about, pubkey from users where username = ?") stmtWhatAbout = preparetodie(db, "select userid, username, displayname, about, pubkey from users where username = ?")
@ -1340,7 +1351,6 @@ func prepareStatements(db *sql.DB) {
stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers") stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers")
stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?") stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?")
stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?") stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?")
stmtZonkIt = preparetodie(db, "update honks set what = 'zonk' where userid = ? and xid = ?")
stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl')") stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl')")
stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)") stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)")
stmtGetBoxes = preparetodie(db, "select ibox, obox, sbox from xonkers where xid = ?") stmtGetBoxes = preparetodie(db, "select ibox, obox, sbox from xonkers where xid = ?")

View File

@ -65,6 +65,10 @@ func upgradedb() {
doordie(db, "update config set value = 5 where key = 'dbversion'") doordie(db, "update config set value = 5 where key = 'dbversion'")
fallthrough fallthrough
case 5: case 5:
doordie(db, "delete from honks where what = 'zonk'")
doordie(db, "update config set value = 6 where key = 'dbversion'")
fallthrough
case 6:
default: default:
log.Fatalf("can't upgrade unknown version %d", dbversion) log.Fatalf("can't upgrade unknown version %d", dbversion)
} }

View File

@ -70,7 +70,7 @@ var dbtimeformat = "2006-01-02 15:04:05"
var alreadyopendb *sql.DB var alreadyopendb *sql.DB
var dbname = "honk.db" var dbname = "honk.db"
var stmtConfig *sql.Stmt var stmtConfig *sql.Stmt
var myVersion = 5 var myVersion = 6
func initdb() { func initdb() {
schema, err := ioutil.ReadFile("schema.sql") schema, err := ioutil.ReadFile("schema.sql")

View File

@ -25,7 +25,7 @@ convoy: <a href="/t?c={{ .Convoy }}">{{ .Convoy }}</a>
{{ end }} {{ end }}
</div> </div>
{{ end }} {{ end }}
{{ if and .BonkCSRF (not (eq .Honk.What "zonked")) }} {{ if .BonkCSRF }}
<p> <p>
<div> <div>
{{ if not .Honk.Privacy }} {{ if not .Honk.Privacy }}

View File

@ -140,17 +140,6 @@ button a {
.tonked .noise a { .tonked .noise a {
color: #aab; color: #aab;
} }
.zonked {
color: #a79;
}
.zonked .noise {
color: #a79;
font-size: 0.8em;
text-decoration: line-through;
}
.zonked .noise a {
color: #a79;
}
.limited { .limited {
border: 1px solid #a04; border: 1px solid #a04;
color: #a79; color: #a79;